thanks for the replies. a friend pointed out that it isn't necessary for activityid to
be unique. after a cup of coffee i saw his point and realised that i just wanted a
auto-inc value for each activity group, ie:
job_id act_id
1 1
1 2
1 3
1 4
2 1
2 2
3 1
To clarify, a Job has multiple Activities. Activity is a part of 1 Job.
I have kept the Job(id) and Activity(id) as a compound PK of Activity, after realising
it is not possible to have a key part auto-incrementing.
So what I have done is set it as a plain integer and in my session bean I get a
reference to the Job(id), count the activities and add 1 to that when I create the
activity:
| public void createActivity(Integer job, String user, String activity,
| Double duration) throws RemoteException, CreateException,
| FinderException {
| JobLocal jobLocal = jobHome.findByPrimaryKey(job);
| Integer activitySeq = new Integer(jobLocal.getActivities().size() + 1);
| actHome.create(job, activitySeq, user, activity, duration);
| jobLocal.setLastModified(new Date());
| }
|
this will probably cause problems at some stage, I am not happy with it as it is but
it is working when I test it.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3840836#3840836
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3840836
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user