Hi,
I reported previously issues with Castor running in JBoss, in particular,
not persisting the reference in a 1-1 relationship to the DB table. The
workaround was:
- turn off autostore
- not to use key generators
- use a newer mbean (thanks,
Now I have another problem. I am trying to use 1:m (again JBoss 2.4.3 and
Castor snapshot from a couple of weeks ago) - same thing - nothing gets
stored in the many-table. I know there are some JBoss users on the list -
is there a workaround?
What could it be in the appserver container that causes this?
-- Jacek
Here is my test case (this code within a session bean method,
transactionlvel ="requiresnew")
t = new Test(System.currentTimeMillis()); // just give it a unique ID
Company co1 = (Company) pm.findByPrimaryKey(Company.class, new Long(48));
Company co2 = (Company) pm.findByPrimaryKey(Company.class, new Long(50));
Collection cos = new ArrayList(10);
cos.add(co1);
cos.add(co2);
t.setCompanies(cos);
System.out.println("test " + t);
pm.create(t); // pm is an encapsulation of Castor
OUTPUT:
========
[Default] [JBOSSCASTOR] Using overloaded getDatabase()
[Default] test Test 1007154730192 Company Company 48 code FDLT Company 50
code STAT
(that means the objects are set in the cache, no other output, no errors,
no nothing)
Mapping:
=========
<class name="test.Test" identity="testID">
<cache-type type="count-limited" capacity="200"/>
<map-to table="Test"/>
<field name="testID" type="long">
<sql name="testID" type="numeric"/>
</field>
<field name="companies" type="test.Company" collection="arraylist">
<sql name="companyid" many-table="testcompany" many-key="testID"/>
</field>
</class>
Test.java:
============
public class Test implements Serializable {
private long testID;
private Collection companies = new ArrayList(10);
[...]
public Collection getCompanies() {
return companies;
}
public void setCompanies(Collection c) {
this.companies = c;
}
}
SQL> desc test
Name Null? Type
----------------------------------------- -------- -----------
TESTID NUMBER
SQL> desc testcompany
Name Null? Type
----------------------------------------- -------- -----------
COMPANYID NUMBER
TESTID NUMBER
Jacek Kruszelnicki
Numatica Corporation
E-mail: [EMAIL PROTECTED]
Phone: (781) 756 8064
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev