-->
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.  [ 11 posts ] 
Author Message
 Post subject: Strange bug and workaround
PostPosted: Sat Jul 23, 2005 3:13 pm 
Newbie

Joined: Sat Jul 23, 2005 2:53 pm
Posts: 4
Hibernate version: 3.0.5


Hi forum,

I don't really need an answer to this one as I already discovered a workaround - so this is just to let you know.
But, if anyone wants more specific info, just say so.

The situation is as follows:
I have a postgresql database (PostgreSQL 7.4.7 on i386-pc-linux-gnu, compiled by GCC gcc-3.3.gcc-opt (GCC) 3.3.5 (Debian 1:3.3.5-8ubuntu2) )
and have built a Java (1.5.0.0.4) swing application that persists its data to it through Hibernate v 3.0.5.

The problem in case concerns a table that has several sub-classes mapped to it. One of these sub-classes has a many-to-one foreign key (plus FK column of type INT4) that is mapped to an attribute in the subclass named 'frequency'; this attribute thus being of the type of the target entity/class (being a complex data type).

What happened is that every time the application tries to just retrieve (nothing saved, updated or deleted!) the 'frequency' attribute, Hibernate automatically sets this foreign key value to null, deleting it.

I spent hours hunting down the source of this unwanted behaviour (including recreating and renaming the foreign key and key field), changed the name to 'freq' ; and finally renamed the attribute to 'medFreq'.
This last action solved the problem.

So, basically, it comes down to this: that Hibernate, in this particular setting, nullifies the foreign key value of a POJO attribute that is named 'frequency'. If I change the name to freq' - nothing changes.
But if I change the name to 'medFreq' - it works OK!

puzzled,
Maike


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 23, 2005 6:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is certainly not true.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 23, 2005 9:16 pm 
Newbie

Joined: Sat Jul 23, 2005 2:53 pm
Posts: 4
well, I'm afraid it *is*.

gavin wrote:
This is certainly not true.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 12:38 am 
Newbie

Joined: Sat Jul 23, 2005 2:53 pm
Posts: 4
And to add to that: I find it curious that I get such a reply from someone from the Hibernate team.

Honestly, I find it rather feeble to comment with a mere "not true" after I have taken the effort to report something that has at least all the apparent characteristics of a bug. I'm not selling any nonsense here. This has cost me several hours to track down and I thought I would do the Hibernate community a service by reporting it.

I admit that it sounds like a very strange bug but I've seen more things like this after 10+ years of programming. These things happen.

And should it be the case that it all turns out my own fault, that I've overlooked something obvious, well, my sincere apologies for wasting your time.

But I've checked all other possible causes over and over again, and I do think there's something that is not the fault of selective blindness or what have you.

So, if you are really interested I could provide the other details of the situation in which the error occurred.
And if not, ok, then I'm wasting my time here.

Regards
Maike Dulk
Programmer
University of British Columbia
Department of Family Practice


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 12:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use your debugger to find your bug. Stop blaming Hibernate.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 1:33 am 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
gavin wrote:
Use your debugger to find your bug. Stop blaming Hibernate.

I have to agree. Are you really insisting that we believe hibernate has a bias against properties named 'frequency'?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 1:33 am 
Newbie

Joined: Sat Jul 23, 2005 2:53 pm
Posts: 4
Ok, suit yourself.

A last word of advice: I would suggest you wouldn't consider a tool, however good it is, as something *holy*.

I'll take note of the treatment I received here, and I wish you all the best.

good-bye,
Maike

Oh, and debugging was of course the first thing I did.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 1:49 am 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
Maike wrote:
I would suggest you wouldn't consider a tool, however good it is, as something *holy*.

*sigh*


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 1:53 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Maike wrote:
Ok, suit yourself.

A last word of advice: I would suggest you wouldn't consider a tool, however good it is, as something *holy*.

I'll take note of the treatment I received here, and I wish you all the best.

good-bye,
Maike

Oh, and debugging was of course the first thing I did.


Might I suggest you post an complete example where this problem exists ?

Nobody here thinks hibernate is *holy*, and certainly not gavin, but the vast majority of *bugs* posted in this forum are in fact user error.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 3:16 am 
Senior
Senior

Joined: Tue Jun 21, 2005 10:18 am
Posts: 135
Location: South Carolina, USA
pksiv wrote:
Might I suggest you post an complete example where this problem exists ?

Agreed. Better yet, create an isolated test case where hibernate exhibits this behavior. I'm really not trying to be rude, but what you've given us is akin to saying Windows XP has a built in aversion to users named Jim. It's possible, yes, but highly unlikely.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 5:19 am 
Beginner
Beginner

Joined: Wed May 04, 2005 5:17 am
Posts: 40
I dunno, I sometimes feel most computers have an aversion to my usercode ;)


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