Hi,
I am using JBoss 2.2.1 with CMP beans using hypersonic as the backend
(default config).
For three weeks, we have been running the same application that creates
9 products (once, after wiping the database and restarting jboss). The
primary key is Product.name (String). Yesterday, ProductHome.findAll()
started returning 14 products, some having duplicate primary keys.
This raised three questions.
1. Is there any known issue that would "create" entity beans WITHOUT
their home.create() being called (the duplicate products appear some
time after they are created).
2. How can findAll() return duplicate primary keys? Shouldn't
hypersonic disallow this, or is this a jboss/jaws bug.
3. Is there any way to stop this behaviour, it seems pretty serious.
I have tested the duplicate primary keys to see if they are references
to the same objects (==), and they are not.
What the hell is going on? Any help would be greatly appreciated.
Thanks,
Lisa
------------------
[lisa@furby Tests]$ java TestProd
List of Primary Keys returned by ProductHome.findAll()
0:Basil
1:Alfalfa
2:Delivery
3:Delivery
4:Corriander
5:Licyourass
6:Licyourass
7:Tomatoes
8:Tomatoes
9:Mushies
10:Happles
11:Happles
12:Horanges
13:Horanges
----------------------- TestProd.java ---------------
import java.util.Collection;
import java.util.Iterator;
public class TestProd {
public static void main (String[] args) throws Exception {
ProductHome ph = (ProductHome)Util.getHome("Product",
ProductHome.class);
Collection prods = ph.findAll();
Iterator i = prods.iterator();
int cnt = 0;
System.out.println("List of Primary Keys returned by
ProductHome.findAll()");
Product lp = null;
while (i.hasNext()){
Product p = (Product)i.next();
if ( p == lp ) System.out.println("NEXT PRODUCT is SAME
OBJECT AS LAST");
System.out.println(cnt + ":" + p.getPrimaryKey());
cnt++;
lp = p;
}
}
}
----------------- snippet of ejb-jar.xml ----------------
<entity>
<ejb-name>Product</ejb-name>
<home>ProductHome</home>
<remote>Product</remote>
<ejb-class>ProductBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>desc</field-name></cmp-field>
<cmp-field><field-name>unit</field-name></cmp-field>
<cmp-field><field-name>unitCostPrice</field-name></cmp-field>
<cmp-field><field-name>qtyOnHand</field-name></cmp-field>
<cmp-field><field-name>minQty</field-name></cmp-field>
<cmp-field><field-name>catPK</field-name></cmp-field>
<primkey-field>name</primkey-field>
<ejb-ref>
<ejb-ref-name>ejb/Category</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>CategoryHome</home>
<remote>Category</remote>
<ejb-link>Category</ejb-link>
</ejb-ref>
</entity>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user