-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to define the filters in a central location.
PostPosted: Fri Aug 31, 2007 5:38 pm 
Newbie

Joined: Thu Jan 12, 2006 4:35 pm
Posts: 13
Hibernate version: 3.2.0CR3

I am trying to define filters in a central location and refer to them in several classes. The way i mapped below generating compilation errors.

filters.hbm.xml
=============

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.model">

<filter-def name="hrAdminVisibility" condition="
<MY CONDITION HERE>">
<filter-param type="long" name="rule"/>
</filter-def>

<filter-def name="hierarchicalVisibility" condition="
<MY CONDITION HERE>">
<filter-param type="long" name="hierarchicalGroup"/>
</filter-def>
</hibernate-mapping>
=========================

and refer to these filters in the actual classes like below..

MyClass.hbm.xml
============

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.model.search">

<class name="FeedbackReportsEmployeeSearch" table="VW_CPD_FDBK_EMP_SEARCH_CUSTOM" mutable="false">

<id name="key" type="long">
<column name="EMPLOYEE_SEQNUM" sql-type="number"/>
</id>

<property name="externalEmployeeId" type="string" column="EXT_SYS_EMP_ID"/>
<property name="employeeStatus" type="string" column="EMP_STATUS_ID"/>
<property name="lastName" type="string" column="LAST_NAME"/>
<property name="firstName" type="string" column="FIRST_NAME"/>
<property name="hireDate" type="date" column="HIRE_DATE"/>
<property name="ftptCode" type="string" column="FTPT_CODE"/>


<!-- Filters down all selected persons by their assigned visibility rule. -->
<filter name="hrAdminVisibility"/>
<filter name="hierarchicalVisibility"/>
</class>

</hibernate-mapping>
============================

The errors:
=======

[java] [INFO] ------------------------------------------------------------------------
[java] [ERROR] FATAL ERROR
[java] [INFO] ------------------------------------------------------------------------
[java] [INFO] null
[java] [INFO] ------------------------------------------------------------------------
[java] [INFO] Trace
[java] java.lang.NullPointerException
[java] at org.hibernate.cfg.HbmBinder.parseFilter(HbmBinder.java:2935)
[java] at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2110)
[java] at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2031)
[java] at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:359)
[java] at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:273)
[java] at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:144)
[java] at org.hibernate.cfg.Configuration.add(Configuration.java:424)
[java] at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:437)
[java] at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:268)
[java] at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1039)
[java] at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentConfiguration.java:38)
[java] at org.codehaus.mojo.hibernate3.HibernateExporterMojo.configureExporter(HibernateExporterMojo.java:186)
[java] at org.codehaus.mojo.hibernate3.exporter.Hbm2JavaGeneratorMojo.configureExporter(Hbm2JavaGeneratorMojo.java:69)
[java] at org.codehaus.mojo.hibernate3.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:241)
[java] at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:140)
[java] at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
[java] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
[java] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
[java] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
[java] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
[java] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
[java] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
[java] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
[java] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
[java] at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[java] at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[java] at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[java] at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[java] [INFO] ------------------------------------------------------------------------


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 04, 2007 9:52 am 
Newbie

Joined: Thu Jan 12, 2006 4:35 pm
Posts: 13
Is this possible at all?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 9:18 am 
Newbie

Joined: Thu Jan 12, 2006 4:35 pm
Posts: 13
Does anybody know the answer, or the question is not clear to people?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.