My JSF application require primary keys to be custom generated when record is 
inserted. and I thought EntityHome.persist() was the place to put the code 
which generate the primary key for new records. so I had as below. but I get 
huge list of errors.

1. can anyone please suggest the best way to do this?
2. is it also possible to use my keyGenerator seam component in JSF to assign 
value to the EntityHome.instance.id field?


  | 
  | @Name("securityRoleHome")
  | public class SecurityRoleHome extends EntityHome<SecurityRole> {
  | ...
  | 
  | @Override
  | public String persist() {
  |  if (Strings.isNull(getSecurityRoleId()) && !this.isManaged()) {
  |  KeyGenerator keyGen = (KeyGenerator) Component.getInstance 
(KeyGenerator.class, true);
  |  setSecurityRoleId(keyGen.getKey(Constant.Database.KeySuffix.ADMIN));
  |  } 
  |  return super.persist();
  | }
  | ...
  | }
  | 



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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093572
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to