Hi , is it possbile in hibernate to have the following mapping ? :
Code:
public class OptionIntra
implements Serializable{
private static final long serialVersionUID = 1L;
private StockExchange stockExchange;
private OptionType optionType;
private int strike;
private PaperEod paperEod;
private Date expirationDate;
private int daysTillExpiration;
private String optionDesc;
private Timestamp timestamp;
private double fairValue;
private int transactionsNumber;
private double transactionMoneySum;
private double price;
@Id
@Enumerated(EnumType.STRING)
@Column(name="stockexchange",nullable=false)
public StockExchange getStockExchange() {return stockExchange;}
public void setStockExchange(StockExchange stockExchange) {this.stockExchange = stockExchange;}
@Id
@Enumerated(EnumType.STRING)
@Column(name="optiontype",nullable=false)
public OptionType getOptionType() {return optionType;}
public void setOptionType(OptionType optionType) {this.optionType = optionType;}
@Id
@Column(name="strike",nullable=false)
public int getStrike() {return strike;}
public void setStrike(int strike) {this.strike = strike;}
@Id
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumns({
@JoinColumn(name="paper_date",nullable=false),
@JoinColumn(name="paper_name",nullable=false),
@JoinColumn(name="paper_id",nullable=false)
}
)
public PaperEod getPaperEod() {return paperEod;}
public void setPaperEod(PaperEod paperEod) {this.paperEod = paperEod;}
it's seems to me like a very common thing to have inside an application yet i can't ge it to work with idclass/embeded ?
i tried using the
Code:
<property name="hbm2ddl.auto">update</property>
just to see how hibernate will treat this i get :
BLOB/TEXT column 'paperEod' used in key specification without a key length , and when i try to trick it by defining the columns that refer to PaperEod and map the relathiontip with the IdClass i get String or byte will be trunced ...
i saw hbm has a key-many-to-one but can't find an annotation for it ?
thanks