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.  [ 2 posts ] 
Author Message
 Post subject: No error when doing a Criteria on an unmapped class ?
PostPosted: Mon Apr 16, 2007 12:36 pm 
Regular
Regular

Joined: Thu Oct 19, 2006 12:07 pm
Posts: 75
If I have some custom classes, like Foo, Bar and Baz and I map two of them (Foo and Bar) then if I try to load the unmapped Baz with a criteria, hibernate does not detect the error.

Code:
Criteria crit = getSession().createCriteria(Baz.class); // no error
...
List l =  crit.list(); // no error here either


the returned list is empty.

There does not seem to be any SQL statements executed.

This is with hibernate 3.2.0.cr2 (inside JBoss 4.0.4GA).

Shouldn't hibernate throw some "UnmappedEntitiy" exception or similar ?

Regards,
David


Top
 Profile  
 
 Post subject: me too
PostPosted: Mon Apr 16, 2007 1:19 pm 
Newbie

Joined: Mon Apr 16, 2007 1:08 pm
Posts: 2
I ran into this the other day. I spent a couple of hours chasing this one around. Our project has multiple context definition files. This worked on two out of three of our context definition files.

I finally changed my code to do a query for the unit test I was working on. I quickly learned that the mapping file was missing from the sessionFactory definition.

I agree that an error should be returned.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.