Re[2]: [JBoss-user] cmp-field and cmr-field mapped to same database column

2003-06-13 Thread Alexey Loubyansky
Hello Russell,

could you provide a testcase or detailed info on how I can reproduce
it?

Thanks,
alex

Thursday, June 12, 2003, 11:27:31 PM, Russell Chan wrote:

RC> Hmmm..

RC> I just tried the same code on jboss-3.2.1 and the new 3.2.2rc1

RC> The code was functional, ableit not what I want for 3.2.1.
RC> The same ear file deployed into 3.2.2rc1 blew up.

RC> I'd file a bug, but I'm still not certain that I haven't coded up
RC> something wrong (I'm still new at the relations stuff), and it's not
RC> jboss' fault.

RC> So, I'll try to include some more code samples and debugging output
RC> here.  Once again, I'm using xdoclet-1.2b, so you'll see those tags
RC> here.  I'll also only include the relevant columns...

RC> TransactionRef is the foreign key which maps to another bean Transaction
RC> whose primary key is transactionRef.



RC> EventQueueBean.java:

RC> Accessor for the foreign key field:
RC> ==
RC> /**
RC>  * getTransactionRef - get TRANSACTION_REF
RC>  *
RC>  * @ejb.interface-method 
RC>  * 
RC>  * @ejb.transaction type="NotSupported"
RC>  * @ejb.persistence column-name "TRANSACTION_REF"
RC>  * @jboss.method-attributes read-only="true"
RC>  * @ejb.value-object
RC>  *  match="Default"
RC>  */
RC> public abstract java.lang.String getTransactionRef ();

RC> /**
RC>  * setTransactionRef - set TRANSACTION_REF
RC>  *
RC>  * @ejb.interface-method 
RC>  * @ejb.value-object
RC>  *  match="Default"
RC>  */
RC> public abstract void setTransactionRef ( java.lang.String aValue
RC> );

RC> ==
RC> Accessor for the foreign key cmr.
RC> /**
RC>  * @ejb.interface-method view-type="local"
RC>  * @ejb.transaction type="Required"
RC>  *
RC>  * @ejb.value-object 
RC>  *  match="Tree"
RC>  * 
RC> aggregate="com.navahonetworks.interfaces.entity.TransactionValue"
RC>  *  aggregate-name="TransactionValue"
RC>  * 
RC> members="com.navahonetworks.interfaces.entity.TransactionValue"
RC>  *  members-name="TransactionValue"
RC>  *  relation="external"
RC>  *
RC>  * @ejb.relation
RC>  *  name="EventQueue-Transaction"
RC>  *  role-name="EventQueue-has-a-Transaction"
RC>  *  cascade-delete="false"
RC>  *  target-ejb="Transaction"
RC>  *  target-role-name="Transaction-has-an-EventQueue"
RC>  *  target-multiple="no"
RC>  *
RC>  *
RC>  * @jboss.relation
RC>  *  fk-column="TRANSACTION_REF"
RC>  *  related-pk-field="transactionRef"
RC>  *
RC>  *
RC>  * @jboss.method-attributes read-only="true"
RC>  *
RC>  */
RC> public abstract
RC> com.navahonetworks.interfaces.entity.TransactionLocal getTransaction();

RC> /**
RC>  * @ejb.interface-method view-type="local"
RC>  * @ejb.transaction type="Required"
RC>  */
RC> public abstract void
RC> setTransaction(com.navahonetworks.interfaces.entity.TransactionLocal
RC> transaction);


RC> ==

RC> Relevant portion of jbosscmp-jdbc.xml:

RC> 
RC>   EventQueue-Transaction

RC>   

RC>   
 
RC> 
EventQueue-has-a-Transaction
RC>   

RC>   
RC>   
 
RC> 
Transaction-has-EventQueues
RC>   
RC>  
RC>transactionRef
RC>TRANSACTION_REF
RC>  
RC>   

RC>   
RC> 

RC> ==

RC> On Jboss 3.2.1:
RC> Here's the query being executed by jboss cmp on the ejbLoad.  Note that
RC> TRANSACTION_REF appears twice... once for the cmr-field, and once for
RC> the cmp-field.

RC> 2003-06-12 16:17:53,522 DEBUG
RC> [org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.EventQueue]
RC> Executing SQL: SELECT EVENT_QUEUE_ID,EVENT_QUEUE_GUID, ENTRY_DATE,
RC> EVENT_TYPE, STATE, TRANSACTION_REF, ATTEMPTS, NEXT_ATTEMPT, PRIORITY,
RC> LOCKED, EVENT_DETAILS, VENDOR_ID, VENDOR_ID, TRANSACTION_REF FROM
RC> OFFNET.EVENT_QUEUE WHERE (EVENT_QUEUE_ID=?) OR (EVENT_QUEUE_ID=?) OR 
RC> (EVENT_QUEUE_ID=?)

RC> This isn't exactly what I want - I'd rather see just one
RC> "TRANSACTION_REF" show here, but it appears to work.  (I'm worried about
RC> what an ejbStore would do - would it try to set it twice? I'll have to
RC> check that).


RC> 

Re: [JBoss-user] cmp-field and cmr-field mapped to same database column

2003-06-12 Thread Alexey Loubyansky
Hello Russell,

it should work properly. Try to upgrade your JBoss version. If the
issue is still there then submit a bug report.

alex

Thursday, June 12, 2003, 5:29:05 PM, Russell Chan wrote:

RC> Hi,

RC> I'm trying to find out if I can have a CMP EJB with a cmp-field
RC> accessors and cmr-field accessors mapping to the same database
RC> column/foreign key.

RC> I'm using jboss-3.2.1 with cmp2 (and xdoclet-1.2b)

RC> In my case, the actual foreign key is enough for some circumstances, and
RC> I don't want to trigger off another database read just to get the
RC> foreign key that's already in the table and that the cmp engine should
RC> already know about. 

RC> Having traced through the sql being generated, if I include accessors on
RC> the column as cmp-fields and a cmr-relation on the same field, the CMP
RC> engine appears to be including the column twice in the generated sql. 
RC> I'm also worried about the effect this will have on updates/inserts.

RC> Is there any way to properly do this in jboss-3.2.1?

RC> I've searched through the archives, and noticed a couple of people
RC> asking this same question.  The answer at the time was "not yet
RC> supported, but soon", but that was way back in December 2002.

RC> Thanks,
RC> Russ



---
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] cmp-field and cmr-field mapped to same database column

2003-06-12 Thread Russell Chan
Hi,

I'm trying to find out if I can have a CMP EJB with a cmp-field
accessors and cmr-field accessors mapping to the same database
column/foreign key.

I'm using jboss-3.2.1 with cmp2 (and xdoclet-1.2b)

In my case, the actual foreign key is enough for some circumstances, and
I don't want to trigger off another database read just to get the
foreign key that's already in the table and that the cmp engine should
already know about. 

Having traced through the sql being generated, if I include accessors on
the column as cmp-fields and a cmr-relation on the same field, the CMP
engine appears to be including the column twice in the generated sql. 
I'm also worried about the effect this will have on updates/inserts.

Is there any way to properly do this in jboss-3.2.1?

I've searched through the archives, and noticed a couple of people
asking this same question.  The answer at the time was "not yet
supported, but soon", but that was way back in December 2002.

Thanks,
Russ





---
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user