-->
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: Hierarchy + Many-To-One
PostPosted: Mon Nov 24, 2003 10:07 am 
Regular
Regular

Joined: Wed Sep 10, 2003 7:09 am
Posts: 63
Hi,

I have a class Hierarchy, lets call A to the father, and a1, a2, a3... to its children (mapped with one-table-per-class strategy). And I have a class B which has a foreign key (many-to-one) to a1.

Initially, a1, a2, a3... were didn't belong to an hierarchy and everything worked fine. When I turned these classes in an extension for A, I got the following error:

net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of B.?

I tried to comment the foreign key B->a1 attribute, and I got a runtime error in another relation many-to-one to a class A children.

I then tried to change B java class code, and changed the type of the foreign key attribute from a1 to A, and it worked.

It seems that there is some kind of bug in many-to-one relations in which the target is an hierarchy class (not the root).

Another thing: I tried do disable reflection optimizer, but it didn't work. I added the following line to my hibernate.cfg.xml:

<property name="hibernate.cglib.use_reflection_optimizer">false</property>


I would like to ask for your assistance.

Thanks,
Joao Rangel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 24, 2003 10:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You must set this property in hibernate.properties. It is "system level", as per the doc.

I am sure you will be able to find the bug in your code if you do this.


Top
 Profile  
 
 Post subject: Solved
PostPosted: Mon Nov 24, 2003 12:21 pm 
Regular
Regular

Joined: Wed Sep 10, 2003 7:09 am
Posts: 63
You're right, after I disable the reflection optimizer it was easy to find MY bug. I was populating my database with wrong data. All A elements were a1, a2 a3... at the same time...

Thanks again for your help,
Joao Rangel


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.