[jboss-user] [JBoss Seam] - EntityHome and Primay Key value assignment for new record
terryb
do-not-reply at jboss.com
Wed Oct 10 11:49:47 EDT 2007
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
More information about the jboss-user
mailing list