Hello everyone,
i'm desperatly trying to write a simple CMR between two Entity Beans using XDoclet and
the additional challenge of using unkown primary keys :)
I have two beans, a User and a Folder bean. Every User has a folder but not every
Folder belongs to a user.
My code so far:
UserBean.java
/**
| * @ejb.bean
| * name = "User"
| * schema = "UserSchema"
| * jndi-name = "User";
| * description = "A User Bean"
| * type = "CMP"
| * cmp-version = "2.x"
| * @ejb.pk
| * class = "java.lang.Object"
| * generate = "false"
| * ---
| * @jboss.unknown-pk
| * class = "java.lang.Integer"
| * column-name = "user_id"
| * auto-increment = "true"
| * sql-type = "INTEGER"
| * jdbc-type = "INTEGER"
| * @jboss.persistence
| * pk-constraint = "false"
| * remove-table = "true"
| * @jboss.entity-command
| * name = "hsqldb-fetch-key"
| */
| public abstract class UserBean implements EntityBean {
| ...
| /**
| * @ejb.interface-method
| * @ejb.relation
| * name = "USER-has-one-FOLDER"
| * role-name = "Every USER has one FOLDER"
| * target-ejb = "Folder"
| * target-role-name = "Some FOLDER belong to a USER"
| * target-cascade-delete = "yes"
| * ---
| * @jboss.relation
| * related-pk-field = "folder"
| * fk-column = "folder_id"
| * dbindex = "true"
| *
| */
| public abstract Folder getFolder();
| }
Folder.java
/**
| * @ejb.bean
| * name = "Folder"
| * schema = "FolderSchema"
| * jndi-name = "Folder";
| * description = "A Folder Bean"
| * type = "CMP"
| * cmp-version = "2.x"
| * @ejb.pk
| * class = "java.lang.Object"
| * generate = "false"
| * ---
| * @jboss.unknown-pk
| * class = "java.lang.Integer"
| * column-name = "folder_id"
| * auto-increment = "true"
| * sql-type = "INTEGER"
| * jdbc-type = "INTEGER"
| * @jboss.persistence
| * pk-constraint = "false"
| * remove-table = "true"
| * @jboss.entity-command
| * name = "hsqldb-fetch-key"
| */
| public abstract class FolderBean implements EntityBean {
| ... (nothing specific to the relation)
| }
This however gives me a DeploymentException:
Role 'Some FOLDER belong to a USER' on Entity Bean 'Folder' : CMP field for key not
found: field name='folder_id'
I assume because of me using an unknown primary key its field is not a normal CMP
field or something...
Is there a way to work around this?
Does anyone know more?
Thanks for the help,
Stud
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3848667#3848667
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3848667
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user