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