-->
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: Question about @AttributeOverrides
PostPosted: Wed Dec 14, 2011 3:49 pm 
Newbie

Joined: Thu Jun 01, 2006 2:15 am
Posts: 7
Hi Forum,

I'm trying to use @MappedSuperclass and @AttributeOverrides in this way:

@MappedSuperclass
public abstract class SuperClass {
@Id protected Long id;
@Basic @Column(name = "aaa") protected String bbb;
}

@Entity @Table(name = "SubTable")
@AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "SubID"))}
public class SubClass {
}

By table looks like:
create table SubTable (
id serial,
aaa varchar(255)
);

But I got two problems:
1. AttributeOverride "id" had to add "insertable = false, updatable = false", otherwise, it will give "Repated mapping column in entity: xxxx" error.
2. Column name "aaa" not been used, system will use default column name "bbbb" instead of from @Column annotation. But the column name from AttributeOverrides been used. So, insert query become "insert into SubTable (id, bob) values (?, ?)".

For first, I can add "insertable = false, updatable = false". But what I did wrong with second one?

Thanks a lot

Noodle


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.