Hi,
I have an Oracle (version 10g) table with column of type ORAXML.
I use Hibernate 3 in eclipse 3.4 with Tomcat 5.5.
Here is my hibernate mapping file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="goldcare.persistence.XxOutboundTransactionDetail" table="XX_OUTBOUND_TRANSACTION_DETAIL">
<id name="transactionDetailId" column="TRANSACTION_DETAIL_ID">
<generator class="gain.site.server.persistence.GAINSequenceGenerator">
<param name="sequence">XX_TRANSACTION_DETAIL_S</param>
</generator>
</id>
<property name="transactionCode" column="TRANSACTION_CODE"/>
<property name="partitionId" column="PARTITION_ID"/>
<property name="ackFlag" column="ACK_FLAG"/>
<property name="processFlag" column="PROCESS_FLAG"/>
<property name="partnerCode" column="PARTNER_CODE"/>
<property name="partnerType" column="PARTNER_TYPE"/>
<property name="partType" column="PART_TYPE"/>
<property name="externalBatchId" column="EXTERNAL_BATCH_ID"/>
<property name="transId" column="TRANS_ID"/>
<property name="concRequestId" column="CONc_REQUEST_ID"/>
<property name="transactionDetails" column="TRANSACTION_DETAILS" type="goldcare.persistence.HibernateXMLType"/>
<property name="errorMessage" column="ERROR_MESSAGE"/>
<property name="parentTransactionId" column="PARENT_TRANSACTION_ID"/>
<property name="creationDate" column="CREATION_DATE"/>
<property name="createdBy" column="CREATED_BY"/>
<property name="lastUpdateDate" column="LAST_UPDATE_DATE"/>
<property name="lastUpdatedBy" column="LAST_UPDATED_BY"/>
<property name="transactionDate" column="TRANSACTION_DATE"/>
</class>
</hibernate-mapping>
Here is my POJO:
package goldcare.persistence;
import java.util.Date;
import oracle.xdb.XMLType;
import org.hibernate.mapping.Column;
public class XxOutboundTransactionDetail {
private long transactionDetailId;
private String transactionCode;
private Integer partitionId;
private String ackFlag;
private String processFlag;
private String partnerCode;
private String partnerType;
private String partType;
private String externalBatchId;
private String transId;
private Integer concRequestId;
@org.hibernate.annotations.Type(type = "goldcare.persistence.HibernateXMLType")
// @Column(name = "TRANSACTION_DETAILS")
private XMLType transactionDetails;
private String errorMessage;
private Integer parentTransactionId;
private Date creationDate;
private Integer createdBy;
private Date lastUpdateDate;
private Integer lastUpdatedBy;
private Date transactionDate;
public long getTransactionDetailId() {
return transactionDetailId;
}
public void setTransactionDetailId(long transactionDetailId) {
this.transactionDetailId = transactionDetailId;
}
public String getTransactionCode() {
return transactionCode;
}
public void setTransactionCode(String transactionCode) {
this.transactionCode = transactionCode;
}
public Integer getPartitionId() {
return partitionId;
}
public void setPartitionId(Integer partitionId) {
this.partitionId = partitionId;
}
public String getAckFlag() {
return ackFlag;
}
public void setAckFlag(String ackFlag) {
this.ackFlag = ackFlag;
}
public String getProcessFlag() {
return processFlag;
}
public void setProcessFlag(String processFlag) {
this.processFlag = processFlag;
}
public String getPartnerCode() {
return partnerCode;
}
public void setPartnerCode(String partnerCode) {
this.partnerCode = partnerCode;
}
public String getPartnerType() {
return partnerType;
}
public void setPartnerType(String partnerType) {
this.partnerType = partnerType;
}
public String getPartType() {
return partType;
}
public void setPartType(String partType) {
this.partType = partType;
}
public String getExternalBatchId() {
return externalBatchId;
}
public void setExternalBatchId(String externalBatchId) {
this.externalBatchId = externalBatchId;
}
public String getTransId() {
return transId;
}
public void setTransId(String transId) {
this.transId = transId;
}
public Integer getConcRequestId() {
return concRequestId;
}
public void setConcRequestId(Integer concRequestId) {
this.concRequestId = concRequestId;
}
public XMLType getTransactionDetails() {
return transactionDetails;
}
public void setTransactionDetails(XMLType transactionDetails) {
this.transactionDetails = transactionDetails;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public Integer getParentTransactionId() {
return parentTransactionId;
}
public void setParentTransactionId(Integer parentTransactionId) {
this.parentTransactionId = parentTransactionId;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public Integer getCreatedBy() {
return createdBy;
}
public void setCreatedBy(Integer createdBy) {
this.createdBy = createdBy;
}
public Date getLastUpdateDate() {
return lastUpdateDate;
}
public void setLastUpdateDate(Date lastUpdateDate) {
this.lastUpdateDate = lastUpdateDate;
}
public Integer getLastUpdatedBy() {
return lastUpdatedBy;
}
public void setLastUpdatedBy(Integer lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
public Date getTransactionDate() {
return transactionDate;
}
public void setTransactionDate(Date transactionDate) {
this.transactionDate = transactionDate;
}
}
and the UserType HibernateXMLType is copied as is from the forum thread:
http://forum.hibernate.org/viewtopic.ph ... ht=xmltype
I got the following error:
Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: goldcare.persistence.HibernateXMLType, for columns: [org.hibernate.mapping.Column(transaction_details)]
Icould not really compile the POJO if I uncomment the line @Column(name="TRANSACTION_DETAILS") that I copied from the Manning book "Java Persistence with Hibernate" (authors Bauer & King). The code from the book seems unclear as where (what jar) I need to get it to compile.
Any tips or recommendations are greatly appreciated.
Thanks.
Gina