[jboss-user] [EJB 3.0] - Override @Id with different generators

hamtho2 do-not-reply at jboss.com
Fri Jul 4 05:29:22 EDT 2008


Hi,

is there a chance to override the defined generator for the @Id?
For example if I´d like to define the @Id in a superclass and only change the value of the db-sequence to use?

For example something like this:


  | @MappedSuperclass
  | public class BaseEntity  {
  |     
  |     @Id
  |     @GeneratedValue(generator="idGenerator")
  |     @SequenceGenerator(name = "idGenerator", sequenceName ="base_entity_id_seq")
  |     protected long id;
  | 
  | ......
  | }
  | 
  | @SequenceGenerator(name = "idGenerator", sequenceName = another_id_seq")
  | public class AnEntity extends BaseEntity {
  | 
  | }

Any input is greatly appriciated

Thomas

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

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




More information about the jboss-user mailing list