-->
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.  [ 1 post ] 
Author Message
 Post subject: Criteria Queries with UserType AuditInfo
PostPosted: Tue Nov 02, 2004 10:21 am 
Beginner
Beginner

Joined: Fri Aug 29, 2003 4:26 am
Posts: 26
Location: Germany, Dortmund
Hi,

I am using the AuditInfo from http://www.hibernate.org/48.html.
Selecting specific objects by using a usertype column within the criteria throws a NPE.
How can I use usertype columns within the criteria API?

In http://forum.hibernate.org/viewtopic.php?t=935420 everything seems okay with cirteria, but not for my example!?

Hibernate version:2.1.6

Mapping documents:
Code:
  <class name="ActorImpl" table="actor" dynamic-update="false">
[...]
    <property name="auditInfo"    type="AuditInfoType">
      <column name="updated"/>
      <column name="created"/>
      <column name="updated_by"/>
      <column name="created_by"/>
    </property>


Code between sessionFactory.openSession() and session.close():
Code:
    Criteria crit =  hs.createCriteria(ActorImpl.class).
                                       add(Expression.isNotNull("updated"));
    crit.list();


Full stack trace of any exception that occurs:
Code:
java.lang.NullPointerException
   at net.sf.hibernate.persister.NormalizedEntityPersister.toColumns(NormalizedEntityPersister.java:1099)
   at net.sf.hibernate.expression.AbstractCriterion.getColumns(AbstractCriterion.java:35)
   at net.sf.hibernate.expression.NotNullExpression.toSqlString(NotNullExpression.java:26)
   at net.sf.hibernate.loader.CriteriaLoader.<init>(CriteriaLoader.java:64)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3595)
   at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
   at com.ssn.acx.api.security.SessionsAndUsersTest.testCriteriaAuditSearch(SessionsAndUsersTest.java:244)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at com.ssn.acx.ACXAbstractTestCase.runTest(ACXAbstractTestCase.java:221)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)


Name and version of the database you are using:HSQLDB 1.7

_________________
Bye
Kai


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

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.