Re: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-07 Thread Alexey Loubyansky
Unfortunately, you can't use this kind of key generation with 
insert-after-ejb-post-create.
[ 784322 ] INSERT after ejbPostCreate
http://sourceforge.net/tracker/?func=detailaid=784322group_id=22866atid=381174

By the spec (and current implementation), the primary key should be set 
in ejbCreate and available in ejbPostCreate. Which is impossible in the 
case there was no INSERT after ejbCreate.
The entity key generation commands that work with 
insert-after-ejb-post-create are pk-sql and key-generator.

Hanson, Matthew wrote:
Hi,

Per your request, I have tested a bean with auto-increment primary key
fields and without foreign-key mappings.
I created a mini-project for Jboss 3.2.2 comprised of only a single bean
class that should have Hypersonic auto-increment and create a primary key
for the bean.  The bean has no relationships at all and does have the
auto-increment tag.  Additionally, just for thoroughness, all of the
insert-after-ejb-post-create tags in standardjboss.xml are set to true.
The null primary key exception was thrown again.


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-05 Thread Hanson, Matthew
*
*   @jboss.column-name name=ssn
*/
public abstract Integer getSSN();
/**
*   @ejb.interface-method view=local
*   @ejb.persistent-field
*
*   @jboss.column-name name=ssn
*/
public abstract void setSSN(Integer theSSN);
/**
*   @ejb.interface-method view=local
*/
public abstract accountHolderBeanData getData();
/**
*   @ejb.interface-method view=local
*/  
public abstract void setData(accountHolderBeanData theData);

/**
*   @ejb.interface-method view=local
*/
public abstract accountHolderBeanValue getaccountHolderBeanValue();
/**
*   @ejb.interface-method view=local
*/  
public abstract void
setaccountHolderBeanValue(accountHolderBeanValue theAccountHolderValue);

/**
*
*   @ejb.create-method
*/
public java.lang.Object ejbCreate(accountHolderBeanValue theValue)
throws CreateException
{
System.out.println(in ejbCreate for value object...);

/*setAccountRoleId(new Integer(1));
setEmailAddress(theValue.getEmailAddress());
setEmailTypeCd(theValue.getEmailTypeCd());
setAccountPassword(theValue.getAccountPassword());*/
this.setaccountHolderBeanValue(theValue);

return null;
}
public void ejbPostCreate(accountHolderBeanValue theValue) throws
CreateException
{
}

/**
*
*   @ejb.create-method
*/
public java.lang.Object ejbCreate(String theEmailAddress,
String theEmailTypeCd,
String theAccountPassword) throws CreateException
{
System.out.println(in ejbCreate for email address...);

setAccountRoleId(new Integer(1));
setEmailAddress(theEmailAddress);
setEmailTypeCd(theEmailTypeCd);
setAccountPassword(theAccountPassword);

return null;
}

public void ejbPostCreate(String theEmailAddress,
String theEmailTypeCd,
String theAccountPassword) throws CreateException
{
this.setAccountId(((accountHolderBeanPK)
entityCtx.getPrimaryKey()).getAccountId());
}
}

Here is the jbosscmp-jdbc.xml (with auto-increment tag):

?xml version=1.0 encoding=UTF-8?
!DOCTYPE jbosscmp-jdbc PUBLIC -//JBoss//DTD JBOSSCMP-JDBC 3.2//EN
http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd;

jbosscmp-jdbc
   defaults
 datasourcejava:/DefaultDS/datasource
 datasource-mappingHypersonic SQL/datasource-mapping
   /defaults

   enterprise-beans

 !--
   To add beans that you have deployment descriptor info for, add
   a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
   that contains the entity/entity markup for those beans.
 --

  entity
 ejb-nameaccountHolderBean/ejb-name
 table-nameaccount/table-name

 cmp-field
field-nameaccountId/field-name
column-nameaccount_id/column-name

auto-increment/
/cmp-field
 cmp-field
field-nameaccountRoleId/field-name
column-nameaccount_role_id/column-name

/cmp-field
 cmp-field
field-nameemailAddress/field-name
column-nameemail_address/column-name

/cmp-field
 cmp-field
field-nameemailTypeCd/field-name
column-nameemail_type_cd/column-name

/cmp-field
 cmp-field
field-nameaccountPassword/field-name
column-nameaccount_password/column-name

/cmp-field
 cmp-field
field-namefirstName/field-name
column-namefirst_name/column-name

/cmp-field
 cmp-field
field-nameSSN/field-name
column-namessn/column-name

/cmp-field

entity-command name=hsqldb-fetch-key
/entity-command
!-- jboss 3.2 features --
!-- optimistic locking does not express the exclusions needed --
  /entity

   /enterprise-beans

/jbosscmp-jdbc

Thanks for all of the help so far!

Regards,
Matt Hanson

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 04, 2003 3:31 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Container Responsibility for CMR Foreign Keys


Key generation commands in 3.2.1 are different from those in 3.2.2. In 
3.2.2 you should have auto-increment/ for generated fields.

Could check whether key generation work for you w/o mapping foreign key 
fields to the primary key fields?

Hanson, Matthew wrote:

 Hi
 
 Just another FYI

RE: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-04 Thread Hanson, Matthew
Hi!

Yes, the pk columns have been created with the identity attribute.  FYI -
the key generation did work properly when the app was deployed to 3.2.1.
It's just that w/3.2.1, I had to do some inefficient fk setting that I hope
to avoid with the 3.2.2 insert-after-ejb-post-create config option.

Regards!
Matt Hanson

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 3:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Container Responsibility for CMR Foreign Keys


Is the column in the database was created with IDENTITY attribute?

Hanson, Matthew wrote:

 Hi--
 
 Well, I added the auto-increment tag to jbosscmp-jdbc.xml, and the null
 primary key exception is still thrown:
 



---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-04 Thread Alexey Loubyansky
Key generation commands in 3.2.1 are different from those in 3.2.2. In 
3.2.2 you should have auto-increment/ for generated fields.

Could check whether key generation work for you w/o mapping foreign key 
fields to the primary key fields?

Hanson, Matthew wrote:

Hi

Just another FYI on the null primary key for auto-increment primary key
problem in jboss-3.2.2.  Basically, the auto-increment keys don't seem to
generate, and I get a null primary key error on creation.  The suggestion
was to add auto-increment/ to jbosscmp-jdbc.xml for the key fields.  I did
that, and the failure still occurs.  Just to be sure, I simply deployed the
jar to 3.2.1.  With 3.2.1, the deployment failed with the following error:
2003-12-04 13:50:16,738 ERROR
[org.jboss.deployment.scanner.URLDeploymentScanner] MBeanException:
Exception in MBean operation 'checkIncompleteDeployments()'
Cause: Incomplete Deployment listing:
Packages waiting for a deployer:
  none
Incompletely deployed packages:
  none
MBeans waiting for classes:
  none
MBeans waiting for other MBeans:
[ObjectName:
jboss.j2ee:jndiName=homebrew/ejb/entity/accountHolderBean,service=EJB
 state: FAILED
 I Depend On: 
 Depends On Me: java.lang.IllegalStateException: auto-increment template not
found]

So, in 3.2.1, I removed the auto-increment/ tag from the beans, and the
app deploys and the bean works (i.e., auto-increment keys are generated
properly).
Can you tell me why the auto-increment tag was suggested for 3.2.2?  Are
there additional tags that must be included?
Please help!!!

Regards,
Matt Hanson


---
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278alloc_id=3371op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-03 Thread Hanson, Matthew
Hi,

I have modified the reentrancy tags for my beans to false, deployed the
beans to binary download of Jboss 3.2.2 with insert-after-ejb-post-create,
and now I catch the following exception in ejbCreate of the n-side bean:

2003-12-03 09:15:53,858 ERROR [org.jboss.ejb.plugins.LogInterceptor]
TransactionRolledbackLocalException in method: public abstract void
homebrew.ejb.interfaces.accountHolderBeanLocal.setaccountHolderBeanValue(hom
ebrew.ejb.interfaces.accountHolderBeanValue), causedBy:
javax.ejb.CreateException: Primary key for created instance is null.
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManage
r.java:520)
at
org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManag
er.java:208)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntit
y(CachedConnectionInterceptor.java:269)
at
org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:580)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)

Is the entity-command name=hsqldb-fetch-key for the bean is being
ignored in Jboss 3.2.2?

Please advise!  Thanks!

Regards,
Matt Hanson

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 3:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Container Responsibility for CMR Foreign Keys


By the spec, you may not establish relationships in ejbCreate but may in 
ejbPostCreate.
By default, INSERT is done after ejbCreate but before ejbPostCreate.
You can use insert-after-ejb-post-create to delay INSERT until after 
ejbPostCreate but this feature is available, AFAIR, since 3.2.2.

Hanson, Matthew wrote:

 Hi,
 
 I am using xdoclet 1.2b2 to generate deployment descriptors and classes,
 including value objects, for two beans that I hope to write with support
for
 CMR.  We also use Jboss 3.2.1 as my app server and hypersonic and/or mysql
 as the db.
 
 Basically, I just want to write a relatively ejb-standard foreign keyed
 insert for 1:n-related beans that are both being creating together.
 
 The bean class generated by xdoclet maintains vectors of added, removed,
and
 updated value objects of the type that is the n-side of the 1:n
relationship
 that I hope to support.  It also generates a set...BeanValue() method to
 process the 1-side bean value object.  This set...BeanValue() methods
 iterates across the n-side value objects and tries to create the n-siders
 via the create followed by Collection.add methods.  The keys on the
1-side,
 however, are not included in the value object, and the create fails the
 non-null foreign key constraint.
 
 Before posting to xdoclet, I stepped back and started to think that the
ejb
 container (Jboss) should probably creating and assigning foreign keys to
the
 n-side with the local interface set methods.  The ejb spec, however, does
 not seem to support this thought, and I do see posts on the jboss site
that
 say the setting of foreign keys of the n-side is generally done in the
 ejbPostCreate method of the 1-side.  Well, I tried that, and I can output
 the n-side value objects in the 1-side ejbPostCreate and see the updated
key
 field, but the insert on the n-side still fails!?!?!?!?.
 
 Now, I also see in the posts that Jboss 3.2.2 may offer a new tag
 insert-after-ejb-post-create in standardjboss.xml that prompts the app
 server to wait until after ejbPostCreate to try to write the n-side of the
 datasource.
 
 Before I spend another day on this, I am wondering if someone can just
tell
 me:
 (1)  Are these keyed inserts on related beans even possible?
 (2)  What is the recommended way to do them?  (Code, new jboss version,
 other?)
 
 Wow - I hope that I am making some sense, because it seems like a very
 common thing to do...
 
 Any help would be great!
 
 Regards,
 Matt Hanson
 
 
 ---
 This SF.net email is sponsored by OSDN's Audience Survey.
 Help shape OSDN's sites and tell us what you think. Take this
 five minute survey and you could win a $250 Gift Certificate.
 http://www.wrgsurveys.com/2003/osdntech03.php?site=8
 ___
 JBoss-user mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/jboss-user
 
 



---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists

Re: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-03 Thread Alexey Loubyansky
How the beans is configured in ejb-jar.xml and jbosscmp-jdbc.xml?

Hanson, Matthew wrote:

Hi,

I have modified the reentrancy tags for my beans to false, deployed the
beans to binary download of Jboss 3.2.2 with insert-after-ejb-post-create,
and now I catch the following exception in ejbCreate of the n-side bean:
2003-12-03 09:15:53,858 ERROR [org.jboss.ejb.plugins.LogInterceptor]
TransactionRolledbackLocalException in method: public abstract void
homebrew.ejb.interfaces.accountHolderBeanLocal.setaccountHolderBeanValue(hom
ebrew.ejb.interfaces.accountHolderBeanValue), causedBy:
javax.ejb.CreateException: Primary key for created instance is null.
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManage
r.java:520)
at
org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManag
er.java:208)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntit
y(CachedConnectionInterceptor.java:269)
at
org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:580)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
Is the entity-command name=hsqldb-fetch-key for the bean is being
ignored in Jboss 3.2.2?
Please advise!  Thanks!

Regards,
Matt Hanson
-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 02, 2003 3:27 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Container Responsibility for CMR Foreign Keys
By the spec, you may not establish relationships in ejbCreate but may in 
ejbPostCreate.
By default, INSERT is done after ejbCreate but before ejbPostCreate.
You can use insert-after-ejb-post-create to delay INSERT until after 
ejbPostCreate but this feature is available, AFAIR, since 3.2.2.

Hanson, Matthew wrote:


Hi,

I am using xdoclet 1.2b2 to generate deployment descriptors and classes,
including value objects, for two beans that I hope to write with support
for

CMR.  We also use Jboss 3.2.1 as my app server and hypersonic and/or mysql
as the db.
Basically, I just want to write a relatively ejb-standard foreign keyed
insert for 1:n-related beans that are both being creating together.
The bean class generated by xdoclet maintains vectors of added, removed,
and

updated value objects of the type that is the n-side of the 1:n
relationship

that I hope to support.  It also generates a set...BeanValue() method to
process the 1-side bean value object.  This set...BeanValue() methods
iterates across the n-side value objects and tries to create the n-siders
via the create followed by Collection.add methods.  The keys on the
1-side,

however, are not included in the value object, and the create fails the
non-null foreign key constraint.
Before posting to xdoclet, I stepped back and started to think that the
ejb

container (Jboss) should probably creating and assigning foreign keys to
the

n-side with the local interface set methods.  The ejb spec, however, does
not seem to support this thought, and I do see posts on the jboss site
that

say the setting of foreign keys of the n-side is generally done in the
ejbPostCreate method of the 1-side.  Well, I tried that, and I can output
the n-side value objects in the 1-side ejbPostCreate and see the updated
key

field, but the insert on the n-side still fails!?!?!?!?.

Now, I also see in the posts that Jboss 3.2.2 may offer a new tag
insert-after-ejb-post-create in standardjboss.xml that prompts the app
server to wait until after ejbPostCreate to try to write the n-side of the
datasource.
Before I spend another day on this, I am wondering if someone can just
tell

me:
(1)  Are these keyed inserts on related beans even possible?
(2)  What is the recommended way to do them?  (Code, new jboss version,
other?)
Wow - I hope that I am making some sense, because it seems like a very
common thing to do...
Any help would be great!

Regards,
Matt Hanson
---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user





---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https

RE: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-03 Thread Hanson, Matthew
 table-nameaccount_address/table-name

 cmp-field
field-nameaccountId/field-name
column-nameaccount_id/column-name

/cmp-field
 cmp-field
field-nameaddressType/field-name
column-nameaddress_type/column-name

/cmp-field
 cmp-field
field-namestreetNumber/field-name
column-namestr_num/column-name

/cmp-field
 cmp-field
field-namestreetName/field-name
column-namestr_name/column-name

/cmp-field
 cmp-field
field-namestreetSuffix/field-name
column-namestr_suffix/column-name

/cmp-field
 cmp-field
field-namecity/field-name
column-namecity/column-name

/cmp-field
 cmp-field
field-namestate/field-name
column-namestate/column-name

/cmp-field
 cmp-field
field-namezipCode/field-name
column-namezip/column-name

/cmp-field
 cmp-field
field-namezip4/field-name
column-namezip4/column-name

/cmp-field
 cmp-field
field-nameprimaryAddress/field-name
column-nameprimary_address/column-name

/cmp-field
 cmp-field
field-namebillingAddress/field-name
column-namebilling_address/column-name

/cmp-field

!-- jboss 3.2 features --
!-- optimistic locking does not express the exclusions needed --
  /entity

  entity
 ejb-nameaccountHolderBean/ejb-name
 table-nameaccount/table-name

 cmp-field
field-nameaccountId/field-name
column-nameaccount_id/column-name

/cmp-field
 cmp-field
field-nameaccountRoleId/field-name
column-nameaccount_role_id/column-name

/cmp-field
 cmp-field
field-nameemailAddress/field-name
column-nameemail_address/column-name

/cmp-field
 cmp-field
field-nameemailTypeCd/field-name
column-nameemail_type_cd/column-name

/cmp-field
 cmp-field
field-nameaccountPassword/field-name
column-nameaccount_password/column-name

/cmp-field
 cmp-field
field-namefirstName/field-name
column-namefirst_name/column-name

/cmp-field
 cmp-field
field-nameSSN/field-name
column-namessn/column-name

/cmp-field

entity-command name=hsqldb-fetch-key
/entity-command
!-- jboss 3.2 features --
!-- optimistic locking does not express the exclusions needed --
  /entity

   /enterprise-beans

  relationships
ejb-relation
  ejb-relation-nameAccount-Recipe/ejb-relation-name

  ejb-relationship-role
 
ejb-relationship-role-nameRecipe-Belongs-To-Account/ejb-relationship-role
-name
  key-fields/

  /ejb-relationship-role
  ejb-relationship-role
 
ejb-relationship-role-nameAccount-Has-Recipes/ejb-relationship-role-name
  key-fields
 key-field
   field-nameaccountId/field-name
   column-nameaccount_id/column-name
 /key-field
  /key-fields

  /ejb-relationship-role
/ejb-relation
ejb-relation
  ejb-relation-nameRecipe-Hops/ejb-relation-name

  ejb-relationship-role
 
ejb-relationship-role-nameRecipe-Has-Hops/ejb-relationship-role-name
  key-fields
 key-field
   field-namerecipeId/field-name
   column-namerecipe_id/column-name
 /key-field
  /key-fields

  /ejb-relationship-role
  ejb-relationship-role
 
ejb-relationship-role-nameHops-Belongs-To-Recipe/ejb-relationship-role-na
me
  key-fields/

  /ejb-relationship-role
/ejb-relation
ejb-relation
  ejb-relation-nameAccount-Address/ejb-relation-name

  ejb-relationship-role
 
ejb-relationship-role-nameAccount-Has-Addresses/ejb-relationship-role-nam
e
  key-fields
 key-field
   field-nameaccountId/field-name
   column-nameaccount_id/column-name
 /key-field
  /key-fields

  /ejb-relationship-role
  ejb-relationship-role
 
ejb-relationship-role-nameAddress-Belongs-To-Account/ejb-relationship-rol
e-name
  key-fields/

  /ejb-relationship-role
/ejb-relation
  /relationships

/jbosscmp-jdbc

Any advice?

Thanks!!!

Regards,
Matt Hanson

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 9:51 AM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Container Responsibility for CMR Foreign Keys


How the beans is configured in ejb-jar.xml and jbosscmp-jdbc.xml?

Hanson, Matthew wrote:

 Hi,
 
 I have modified the reentrancy tags for my beans to false, deployed the
 beans to binary download

Re: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-03 Thread Alexey Loubyansky
The auto incremented/generated field should have auto-increment/ in 
jbosscmp-jdbc.xml



---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


RE: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-03 Thread Hanson, Matthew
  /relationships

/jbosscmp-jdbc

Any other ideas?

Regards,
Matt Hanson

-Original Message-
From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 10:52 AM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Container Responsibility for CMR Foreign Keys


The auto incremented/generated field should have auto-increment/ in 
jbosscmp-jdbc.xml



---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-03 Thread Alexey Loubyansky
Is the column in the database was created with IDENTITY attribute?

Hanson, Matthew wrote:

Hi--

Well, I added the auto-increment tag to jbosscmp-jdbc.xml, and the null
primary key exception is still thrown:


---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


Re: [JBoss-user] Container Responsibility for CMR Foreign Keys

2003-12-02 Thread Alexey Loubyansky
By the spec, you may not establish relationships in ejbCreate but may in 
ejbPostCreate.
By default, INSERT is done after ejbCreate but before ejbPostCreate.
You can use insert-after-ejb-post-create to delay INSERT until after 
ejbPostCreate but this feature is available, AFAIR, since 3.2.2.

Hanson, Matthew wrote:

Hi,

I am using xdoclet 1.2b2 to generate deployment descriptors and classes,
including value objects, for two beans that I hope to write with support for
CMR.  We also use Jboss 3.2.1 as my app server and hypersonic and/or mysql
as the db.
Basically, I just want to write a relatively ejb-standard foreign keyed
insert for 1:n-related beans that are both being creating together.
The bean class generated by xdoclet maintains vectors of added, removed, and
updated value objects of the type that is the n-side of the 1:n relationship
that I hope to support.  It also generates a set...BeanValue() method to
process the 1-side bean value object.  This set...BeanValue() methods
iterates across the n-side value objects and tries to create the n-siders
via the create followed by Collection.add methods.  The keys on the 1-side,
however, are not included in the value object, and the create fails the
non-null foreign key constraint.
Before posting to xdoclet, I stepped back and started to think that the ejb
container (Jboss) should probably creating and assigning foreign keys to the
n-side with the local interface set methods.  The ejb spec, however, does
not seem to support this thought, and I do see posts on the jboss site that
say the setting of foreign keys of the n-side is generally done in the
ejbPostCreate method of the 1-side.  Well, I tried that, and I can output
the n-side value objects in the 1-side ejbPostCreate and see the updated key
field, but the insert on the n-side still fails!?!?!?!?.
Now, I also see in the posts that Jboss 3.2.2 may offer a new tag
insert-after-ejb-post-create in standardjboss.xml that prompts the app
server to wait until after ejbPostCreate to try to write the n-side of the
datasource.
Before I spend another day on this, I am wondering if someone can just tell
me:
(1)  Are these keyed inserts on related beans even possible?
(2)  What is the recommended way to do them?  (Code, new jboss version,
other?)
Wow - I hope that I am making some sense, because it seems like a very
common thing to do...
Any help would be great!

Regards,
Matt Hanson
---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



---
This SF.net email is sponsored by OSDN's Audience Survey.
Help shape OSDN's sites and tell us what you think. Take this
five minute survey and you could win a $250 Gift Certificate.
http://www.wrgsurveys.com/2003/osdntech03.php?site=8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user