-->
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.  [ 1 post ] 
Author Message
 Post subject: Problem using Hibernate CompositeUserType
PostPosted: Tue Apr 12, 2011 11:36 am 
Beginner
Beginner

Joined: Mon Sep 20, 2010 2:35 am
Posts: 20
Hi All,

I am trying my hands on Hibernate's userType and struck in some problem.here is my mapping file

Code:
<hibernate-mapping>
   <class name="MyClass"
      table="MYTABLE">
      <id name="uuid" type="java.lang.String">
         <column name="UUID" />
         <generator class="uuid" />
      </id>

      <property name="MyClass_i18n" type="MyClassi18n" >
         <column name="NAME"/>
         <column name="SHORTDESCRIPTION"/>
         <column name="LONGDESCRIPTION"/>
         <!--<column name="LANGUAGE_ID"/>
   --></property>
 
   </class>
</hibernate-mapping>


and here is the code from my CompositeUserType

Code:
@Override
   public void nullSafeSet(PreparedStatement ps, Object arg1, int index,
         SessionImplementor arg3) throws HibernateException, SQLException {
      
      if(arg1==null){
         //todo
      }
      else{
          MyClass_i18n des=(MyClass_i18n)arg1;
          des=dao.saveMyClass_i18n(des);
          ps.setString(index, des.getXYZ());
          ps.setString(index+1, des.getXYZ());
          ps.setString(index+2, des.getXYZ());
           ps.setString(index+3, des.getXYZ());
         
      }
   }


i want to get access to MyClass instance inside the nullSafeSet(...) method.
i have access to MyClass_i18n in this method but some how not able to get instance of the MyClass.

Is there any way to get reference/access of this MyClass instance

Thanks in advance
Umesh


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.