Hi All,
We recently upgraded from 8.1 to 10.3 and we are using Sybase 12.5 as our database. We use hibernate 2.1.6 jar and jonn3 as our driver. The issue is about reteiving data for acolumn from database. We inserted new data and read data in the same session. Then we closed our application and rebounced our servers and we get null for the same data for that column. We dont have any secondary cache. The column is of type char(2) and not null in database. The column is defined as a type of org.apache.commons.lang.enums.Enum in java. Hibernate mapping for that columns is defined as below
<property name="invntyCd" type="com.xxx.persistence.InventoryCodeEnumType" update="true" insert="true" access="property" > <column name="InvntyCd" length="2" not-null="true" /> </property> The query we used is "select new com.xxx.domain.OutboundInventoryAttributes(" + "PI.cusip, min(PI.wireDt), max(PI.wireDt), SNAP.reSecId, PIP.invntyCd) from " + "PortInventoryPiece as PIP, " + "PortInventory as PI, " + "OutboundInventoryPiece as SNAP " + "where " + "SNAP.reSecId = :reSecId and " + "PIP.id.expcttnRefNo = SNAP.expcttnRefNo and " + "PIP.id.expcttnSrcCd = SNAP.expcttnSrcCd and " + "PIP.id.pieceSeqNo = SNAP.sequenceNumber and " + "PIP.id.expcttnRefNo = PI.id.expcttnRefNo and " + "PIP.id.expcttnSrcCd = PI.id.expcttnSrcCd and " + "PIP.bookStatCd = :bookStatus " + "group by PI.cusip, PIP.invntyCd, SNAP.reSecId"; The constructor for OutboundInventoryAttributes is as below public OutboundInventoryAttributes( String cusip, Date minWireDt, Date maxWireDt, Integer reSecId, String invntyCd) { System.out.println("Inventory code from Hibernate" + invntyCd); this.cusip = cusip; this.minWireDt = new Timestamp(minWireDt.getTime()); this.maxWireDt = new Timestamp(maxWireDt.getTime()); this.invntyCd = invntyCd; this.reSecId = reSecId; } The nullSafeGet is defined as below ublic Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { String enumCode = null; // get the value into the resultset based on the column type switch(getColumnType()) { case INT_TYPE: enumCode = ((Integer)Hibernate.INTEGER.nullSafeGet(rs, names[0])).toString(); break; case LONG_TYPE: enumCode = ((Long)Hibernate.LONG.nullSafeGet(rs, names[0])).toString(); break; case STRING_TYPE: default: enumCode = (String) Hibernate.STRING.nullSafeGet(rs, names[0]); } return EnumUtils.getEnum(this.enumClass, enumCode); } Please let me know if anyone have some suggestions for this problem. Thanks in Advance Nirupa
|