-->
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: Problem with Map and @AttributeOverride
PostPosted: Wed Mar 05, 2008 11:41 pm 
Newbie

Joined: Mon Aug 14, 2006 3:14 am
Posts: 2
Hi,

I have the following class attribute declared as a Map with the associated annotations;

@CollectionOfElements
@JoinTable(name="CREDIT_CARD_TRANSACTIONS", joinColumns = @JoinColumn(name="CREDIT_CARD_ID"))
@MapKey(columns=@Column(name="TRAN_ID"))
private Map<String, Transaction> transactions;

I use a String value as the key for the map and the Map value contains a Transaction instance. This all works fine.

I would like to override one of the column names in the CREDIT_CARD_TRANSACTION table so that it is not the default attribute value as so;

@CollectionOfElements
@JoinTable(name="CREDIT_CARD_TRANSACTIONS", joinColumns = @JoinColumn(name="CREDIT_CARD_ID"))
@MapKey(columns=@Column(name="TRAN_ID"))
@AttributeOverride(name="element.description",column=@Column(name="TRAN_DESCRIPTION"))
private Map<String, Transaction> transactions;

However doing so causes an error in which an attempt is made by Hibernate to add the attributes of the String class; value, offset, count, hashCode; into the table as so;

java.sql.SQLException: Table not found in statement [insert into CREDIT_CARD_TRANSACTIONS (CREDIT_CARD_ID, value, offset, count, hashCode, description) values (?, ?, ?, ?, ?, ?)]

The Transaction class is as follows;

@Embeddable
public class Transaction
{
@Column(length=255, nullable=false)
private String description;

...

Why does adding an @AttributeOverride annotation cause this behaviour and is there a way of achieving what I'd like to do using this annotation?

Thank you for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 08, 2008 12:54 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
if you can write a minimal reproducible test case, post it to JIRA. But this is really weird

_________________
Emmanuel


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.