-->
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: Xdoclet–Unable to specify the data type of the subclass
PostPosted: Mon Sep 17, 2007 6:22 pm 
Newbie

Joined: Tue Aug 07, 2007 4:46 pm
Posts: 3
I am using hibernate 3 and Xdoclet to build the mapping files and export the schema of my SQL Server 2005 database. I am using 'table per subclass' approach to map a class hierarchy to a relational database. Although, I am having difficulty specifing the data type for foreign key of the subclass.

For example, say I have three two classes: Payment and CashPayment. Payment is the superclass and CashPayment is the subclasses. If I don’t specify the data type, hibernate will interpret my id type, which is a Long, to have a data type to be numeric(19,0). My Project's business rules specify that this data type needs to be a bigint. I am able to change the primary key’s data type for the superclass. However, I am not able to change the data type of the subclasses that extends my superclass.

Does somebody know the xdoclet annotation to enforce the key in the subclass to be a specified datatype such as a bigint?

Code Example:

/**
* @hibernate.class
*/
public class Payment {
private Long id;
private Double amount;
/**
@hibernate.id generator-class="hilo" unsaved-value="null"
* @hibernate.column name="ID" sql-type="bigint"
* @hibernate.property name="ID" type="long"
*
*/
public Long getId() {return id;}
public void setId(Long id) {this.id = id;}
/**
* @hibernate.property
*/
public Double getAmount() {return amount;}
public void setAmount(Double amount) {this.amount = amount;}
}

/**
* @hibernate.joined-subclass
* @hibernate.joined-subclass-key
* column="id"
*/
public class CashPayment extends Payment {
private String something;
/**
* @hibernate.property
*/
public String getSomething() {return something;}
public void setSomething(String something) {this.something = something;}
}


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