[jboss-user] [JBoss Seam] - Link a user with the entities he/she created
eroussel
do-not-reply at jboss.com
Mon Dec 3 17:10:20 EST 2007
Hello,
I'm fairly new the Seam and looking for some advice on achieving the following:
Some tables (entities) in my application contain data that must be associated with the user that created the record.
I got the part where the entities are annotated properly to describe the 1 to * relationship.
The question I have is which one of the two following approaches Seam veterans would recommend to use (or if neither are appropriate, what's the alternative).
Approach A would be to override the "persist" method in entityHome such as:
| public class myEntityHome extends EntityHome<MyEntity>
| {
| ...
| @In
| User user; // That's the entity with the user's data
|
| ...
| @Override
| public String persist() {
| this.getInstance().setSubmitter(user); // Recording who created this using the entity's setter
| return super.persist();
| }
| }
|
Approach B would be to handle this in an "action" bean.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110025#4110025
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110025
More information about the jboss-user
mailing list