-
1. Re: CMR - FK/PK issue
lafr Feb 2, 2003 1:47 PM (in response to steveridley)This is the typical result of using remote interfaces for CMR.
You must only use local interfaces for CMR ! -
2. Re: CMR - FK/PK issue
steveridley Feb 3, 2003 8:59 AM (in response to steveridley)For those interested in this thread, I can confirm that with jboss3.2.0RC1, it is possible to have a foreign key as part of a simple or compound primary key !
I have finally managed to create and test a working example with the help of the testsuite. The relationship cardinality was correctly observed as was a cascade delete. Nice. . .
My ClassCast problem disappeared after reorganising jbosscmp-jdbc. Obviously I had got it wrong during previous attempts.
Phew. . . . . . .
Steve. -
3. Re: CMR - FK/PK issue
sebastien_petrucci Feb 5, 2003 4:38 AM (in response to steveridley)Hi,
Could you please provide more explanations and samples ?
Thx,
Sebastien. -
4. Re: CMR - FK/PK issue
ctrawick Feb 5, 2003 8:39 AM (in response to steveridley)Yes please do. Specifically, I'm interested in the PK class.
Here's what I've tried so far... I have a User bean that contains information about a user and I have a Tasks bean that contains information about certain tasks. In between them I have a UserTasks bean that maps the two plus contains other properties about the mapping. Its PK is the composite of the User bean's PK and the Task bean's PK:
public class UserTaskPK {
public UserPK user;
public TaskPK task;
// getters and setters
}
The UserTask bean has CMR fields user and task. All beans use local interfaces.
This was my best guess for how to create the PK class, however when navigating to UserTask from User JBossCMP 3.2.0 generates an empty select clause:
SELECT FROM UserTasks WHERE (userid=?)
Historically, this has been because the CMP engine could not match fields from the PK class to the entity properties. I've also tried putting the UserPK and TaskPK fields themselves in the UserTaskPK to no avail.
So, how do I structure the PK class so that composite PKs work? -
5. Re: CMR - FK/PK issue
steveridley Feb 6, 2003 5:05 PM (in response to steveridley)Yes of course,
I shall post a full working example tomorrow (is 10pm GMT) here and very tired !!!
Regards,
Steve. -
6. Re: CMR - FK/PK issue
hergaty Mar 24, 2004 4:32 PM (in response to steveridley)Hi Steve,
can you still provide your example or do you know where I can have a look into one that explains the same problem?
Best Regards,
Thomas