[jboss-user] [EJB 3.0] - Override Primary Key Mapping

poupou do-not-reply at jboss.com
Thu Jul 27 08:50:34 EDT 2006


Hi,
I am trying to override the primary key mapping in subclasses. The problem is that the table created for the subclass keeps both two columns: the primary key of the superclass and the overriden mapping.
Here is the code:

@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public abstract class MyAbstractSuper {
	private Long id_MyAbstractSuper;
	@Id
	public Long getId_MyAbstractSuper() {
		return id_MyAbstractSuper;
	}
	public void setId_MyAbstractSuper(Long id_MyAbstractSuper) {
		this.id_MyAbstractSuper = id_MyAbstractSuper;
	}
}

@Entity
@Table(name="MySubClass")
@AttributeOverride(name="id_MyAbstractSuper",column=@Column(name="id_MySubClass"))
public class MySubClass extends MyAbstractSuperclass {

	@Override
	public Long getId_MyAbstractSuperclass(){
		return super.getId_MyAbstractSuperclass();
	}
}

I read that there was a bug with javassist and tried to replace it with cglib but the problem still remains.

Thank you.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961283#3961283

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961283



More information about the jboss-user mailing list