-->
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: Composite id with null key-properties
PostPosted: Wed Jun 16, 2004 11:13 am 
Newbie

Joined: Tue Feb 24, 2004 12:06 pm
Posts: 7
Hi all;

l have a problem with the query cache on a table wich has no pk. I know it's bad, but i have no other choice.

Th problem is that i defined in the mapping file some properties as part of the composite key. However, these properties may be null.

The problem comes when i want to use the query cache: the first time the query is executed, the identifiers are put into the cache.
And the next time the query is executed, the values of the identifiers are get from the cache.
Then, if the objetcts corresponding to these identifiers are not in the cache, hibernate temps to load them.

Here is the problem: i saw that when it temps to load an objet with null key properties, it replaces null by '' in the query... And so, i get an object not found exception...

Is there a mean to avoid this? (except by putting a pk or avoiding to use the query cache...)

Thanks in advance for the answer.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 11:28 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
i have a problem which may be similar, i have a class A, it has a composite-id, let's say keyA,keyB,keyC, keyC can be null

when i call session.delete("from A a where a.keyA = xxx")
it deletes all rows except those where keyC is null.

i think it's a myTeam' bug but when i take a look at logs, sql generated is
delete from table where keyA = ?and keyB = ? and keyC = ?

shouln't i see also
delete from table where keyA = ?and keyB = ? and keyC is null ?


forget my post if you think it is not related, i'll take a llok at my team code later...

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 16, 2004 12:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Hibernate really excepts all composite-id propertys to be not-null AFAIK


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.