-->
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.  [ 5 posts ] 
Author Message
 Post subject: UserType is being returned as null from cglib call
PostPosted: Tue Apr 12, 2005 9:20 am 
Regular
Regular

Joined: Fri Feb 13, 2004 10:02 pm
Posts: 90
Hibernate version:
3.0 release
Mapping documents:
Code:
<hibernate-mapping package="com.llic.calc.variable">
  <joined-subclass name="DatabaseVariable" table="DatabaseVariable" extends="Variable">
 
   <key column="variableId"/>
         
   <property name="className" column="className" type="string"/>
   
   <property name="property" column="property" type="string"/>
   
   <bag name="parameters" table="objectProperties" cascade="all" lazy="false">
         <key column="variableId"/>
         <one-to-many class="com.llic.ides.dao.impl.HibParameter"/>
   </bag>
   
   <many-to-one name="hibParam" class="com.llic.ides.dao.impl.HibParameter" cascade="all" lazy="false"/>
 
   
  </joined-subclass>
</hibernate-mapping>


Code:
<hibernate-mapping package="com.llic.ides.dao.impl">
  <class name="HibParameter" table="HibParameter">
 
    <id name="id" column="parameterid" type="java.lang.Long">
      <generator class="native" />
     
    </id>
   
         
   <property name="parameterName" column="parameterName" type="string"/>
   
   <property name="operand" column="operand" type="int" not-null="true"/>
   
   <property name="value" column="value" type="com.llic.calc.dao.hibernate.type.ObjectTypePersister"/>
   
  </class>
</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
session.merge(obj); //where obj is an instance of idesdata

Full stack trace of any exception that occurs:
None

Name and version of the database you are using:
MySQL 4.0

When my usertype is called for the object "value" then the value of the object in every call is null. Using the debugger, I can clearly see that the "entity.value" object is an instanciated java.util.Date object. It appears that the call to persister.getPropertyValues(entity, source.getEntityMode()) on line 230 of DefaultMergeEventListener is returning a null for the "value" field in the Object array. How can I get around this? I have a few other custom persisters that are working fine, this really has me stumped....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 10:23 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Dissable "optimizer" in configuration properties, it will help to debug.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 13, 2005 9:21 am 
Regular
Regular

Joined: Fri Feb 13, 2004 10:02 pm
Posts: 90
I have set the cglib optimizer property to false, but hibernate appears to still use cglib, not using the reflection mechanism. The property I added to my config is...

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


In the PojoTupilizer class line 182, It is still calling getPropertyValuesWithOptimizer(entity);

Code:
public Object[] getPropertyValues(Object entity) throws HibernateException {
      if ( shouldGetAllProperties( entity ) && optimizer != null ) {
         return getPropertyValuesWithOptimizer( entity );
      }
      else {
         return super.getPropertyValues( entity );
      }
   }




Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 14, 2005 9:44 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
this is a system level property (as per the doc) you need to set it in the .properties or through a -D option

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 15, 2005 12:35 am 
Beginner
Beginner

Joined: Mon Dec 15, 2003 5:25 am
Posts: 48
Location: Delhi, India
It does not work programmatically also

Code:
configuration.setProperty("hibernate.cglib.use_reflection_optimizer", "false")

_________________
Vinod K. Singh


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