-->
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.  [ 2 posts ] 
Author Message
 Post subject: Code snippets "Java Persistence with Hibernate" bo
PostPosted: Mon Oct 06, 2008 5:25 pm 
Newbie

Joined: Wed Dec 12, 2007 2:30 pm
Posts: 3
Hi,

I like the format of the book. However, when trying out the code snippet in the book, I could not compile it. I have to look for the jar files that might contain a class with the name used. It would be nice if a jar filename is mentioned or a "complete" name of the class is mentioned. For example, on page 227, the snippet code included is:
<b>@org.hibernate.annotations.Type( type="persistence.MonetaryAmountUserType")
@Column(name="INITIAL_PRICE")
private MonetaryAmount initialPrice;</b>
Here, I was able to search for a jar that contain org.hibernate.annotations.Type, but it does not much help to search for a correct one that contains Column (for the @Column presented in the code). Please clarify.

Thanks,
Gina


Top
 Profile  
 
 Post subject: Could not determine type for:...
PostPosted: Mon Oct 06, 2008 5:36 pm 
Newbie

Joined: Wed Dec 12, 2007 2:30 pm
Posts: 3
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


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

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.