-->
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: Parameter not bound with UserType
PostPosted: Tue Mar 14, 2006 8:15 am 
Newbie

Joined: Wed Oct 08, 2003 6:19 am
Posts: 9
Hello,
i have this property:

Code:
<property name="datdoc" type="CompositeDateUserType">
      <column name="DATDOCGG" length="2" />
      <column name="DATDOCMM" length="2" />
      <column name="DATDOCAA" length="2" />
</property>


and all work fine when i load an object from Db, but when i try to filter this property there is no property bound in the prepare statement

Code:
public void nullSafeSet(PreparedStatement statement, Object value, int index, SessionImplementor session)
   throws HibernateException, SQLException {

      if (value == null) {
         statement.setNull(index, Types.VARCHAR);         
         statement.setNull(index+1, Types.VARCHAR);
         statement.setNull(index+2, Types.VARCHAR);
      } else {
         DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
          String s = formatter.format(value);
         statement.setString(index, s.substring(0,2));
         statement.setString(index+1, s.substring(3,5));
         statement.setString(index+2, s.substring(6,10));
         
         ParameterMetaData pmd = statement.getParameterMetaData();
         System.out.println(pmd.getParameterCount() );
      }
   }



this is the log
Code:
2006-03-14 12:59:03,921 DEBUG [org.hibernate.jdbc.AbstractBatcher] preparing statement
2006-03-14 12:59:03,921 DEBUG [org.hibernate.type.CharacterType] binding 'A' to parameter: 1
2006-03-14 12:59:03,921 DEBUG [org.hibernate.type.CharacterType] binding 'S' to parameter: 2
2006-03-14 12:59:03,921 DEBUG [org.hibernate.type.CharacterType] binding null to parameter: 3
2006-03-14 12:59:03,921 DEBUG [org.hibernate.type.StringType] binding null to parameter: 7
2006-03-14 12:59:03,921 DEBUG [org.hibernate.type.StringType] binding null to parameter: 8
2006-03-14 12:59:03,921 DEBUG [org.hibernate.type.StringType] binding null to parameter: 9
2006-03-14 12:59:03,921 DEBUG [org.hibernate.type.StringType] binding null to parameter: 10



miss from 4 to 6


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.