OC4J 9.0.4 / EJB-QL / cmr-field
Hi,
I'm using the OC4J 9.0.4 developer preview and am trying to construct some EJB-QL of the following form:
select object(A) from MANYTABLE A, IN (A.cmr_field_to_ONETABLE) AS B
where A.field = ?1 and B.pk_field = ?2
where ONETABLE has a 1:m bidirectional relationship with MANYTABLE. The cmr-field entry for cmr_field_to_ONETABLE is present in the ejb-jar.xml.
In the underlying database tables, the cmr_field_to_ONETABLE in A is a foreign key to pk_field of B.
When I attempt to deploy the application, OC4J screams about an "Error translating EJBQL" saying that:
Was expecting one of:
"AbstractSchemaName" ...
"IN" "(" "IdentificationVar" "." "SingleValuedCmrField" "." ...
"IN" "(" "IdentificationVar" "." "CollectionValuedCmrField" ...
This doesn't make sense to me. As far as I can see, the EJB-QL is correct.
Suggestions?
regards
George
Hi,
I'm using the OC4J 9.0.4 developer preview and am trying to construct some EJB-QL of the following form:
select object(A) from MANYTABLE A, IN (A.cmr_field_to_ONETABLE) AS B
where A.field = ?1 and B.pk_field = ?2
where ONETABLE has a 1:m bidirectional relationship with MANYTABLE. The cmr-field entry for cmr_field_to_ONETABLE is present in the ejb-jar.xml.
In the underlying database tables, the cmr_field_to_ONETABLE in A is a foreign key to pk_field of B.
When I attempt to deploy the application, OC4J screams about an "Error translating EJBQL" saying that:
Was expecting one of:
"AbstractSchemaName" ...
"IN" "(" "IdentificationVar" "." "SingleValuedCmrField" "." ...
"IN" "(" "IdentificationVar" "." "CollectionValuedCmrField" ...
This doesn't make sense to me. As far as I can see, the EJB-QL is correct.
Suggestions?
regards
George
Similar Messages
-
How do i define a cmr-field through ejbgen annotations in weblogic?
I have defined the relation as
* @ejbgen:relation
* multiplicity = one
* name = EntityCanHaveMultipleJournals
* role-name = EntityHasJournals
* target-ejb = FTEntityEJB
* @ejbgen:ejb-local-ref
* home = ft.infosys.journal.FTJournalHome
* local = ft.infosys.journal.FTJournalLocal
* jndi-name = FTJournal
* name = Journal
* type = Entity
And the accessor/mutator as:
* @ejbgen:cmr-field
* @ejbgen:local-method transaction-attribute = NotSupported
abstract public Collection getJournals();
* @ejbgen:local-method transaction-attribute = Required
abstract public void setJournals(Collection val);
Though this does not give any error on executing ejbgen,and the local and home interfaces are fine;the CMR field is not appearing in the relations tag in ejb-jar.xml.
So i have to add the following manually in ejb-relations:
<cmr-field>
<cmr-field-name>journals</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
Why so?cmr field which is "category" in ur mapping , u can't use as cmp field in abstract schema mapping. just remove category from cmp field . and every thing is fine
-
EJB QL with cmr field sintax error
Hello I have some EJBs related to some tables .
In particular I have 2 EJB with follow schema and relathionship:
EJB_T (n)<----------------------->(1) EJB_C
So I have the CMR field in EJB_C named transactions
THE query
SELECT OBJECT(trans) FROM EJB_C_NAME AS c, IN (c.transactions) AS trans WHERE c.id = ?2 AND trans.data >= ?1
It seems all ok but embeded OC4J (1.3.1) don't deploy application and throw an Exception related to QUERY PARSING .
can anyone help me ? please.
thanks in advanceOC4J used is 10g
-
EJB-QL with self referencing cmr-field in path identifier fails
I have a simple application . Only one bean and one relationship. The relationship is a (0..1)-(0..1) for the same bean (self referencing).
I have a finder method defined with ejb-ql that tries to access the field of one of the cmr fields of the relationship.
class1Bean is the abstract schema for my bean, and subclass1 is the cmr-field name.
SELECT OBJECT(obj) FROM class1Bean obj WHERE obj.subclass1.id LIKE ?1
Here is the error message when trying to deploy:
Bean: Class1
Method: java.util.Collection findBySubclass1(java.lang.String)
EJBQL: SELECT OBJECT(obj) FROM class1Bean obj WHERE obj.subclass1.id LIKE ?1
Error: JDO75100: Fatal internal error: JDO75341: Missing field meta data for field 'subclass1' of 'Class1'
This same code deploys fine on JBoss 4.0, and should be legal ejb-ql. Is this a known issue with Sun JSAS?Sounds like a problem with the bean metadata. Please check the entity mapping defined in sun-cmp-mappings.xml. Also make sure field sublass1 is defined as CMR everywhere.
-- markus. -
Javax.ejb.EJBException: Attempt to access a collection valued cmr-field
I have 2 local CMP project and defect
i have a method getDefectList in ProjectBean. This method returns a collection of defect object.The relationship of Defect and Project is defined in ejb-jar where project can contain many defects.
when i try to access this method in a session bean it gives me the error
"javax.ejb.EJBException: Attempt to access a collection valued cmr-field outside the scope of a transaction."
Please let me know the solution.After further research, it looks like CMR fields can only use three options for the trans-attribute: Mandatory, Required, or RequiresNew
<container-transaction>
<description>Transaction attributes</description>
<method>
<ejb-name>strong.customer</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Mandatory</trans-attribute>
</container-transaction>
thus I believe that you will have to begin a transaction before executing your method. -
Orion-ejb-jar: cmp-field-mapping specs REMOTE home
In the tech. preview documentation, in the EJB dev. guide, and in the section which details the orion-ejb-jar, I noticed something odd about the "cmp-field-mapping" element. It has an attribute called "ejb-reference-home", which is supposed to be "the JNDI location of the fields remote EJB-home if the field is an entity EJBObject or EJBHome".
I would assume this would only be set if this field was specified as a CMR field in the ejb-jar.xml file.
The odd thing is, it specifies the REMOTE home, not the LOCAL home. Is this just a typo?I believe that it is not JDeveloper issue but OC4J one. It does not pick up new orion-ejb-jar.xml if you re-deploy bean(s). It should deploy your orion-ejb-jar.xml when you're deploying yor application for the first time (so there is not orion-ejb-jar.xml in deployments directory). If you want OC4J to pick changes up remove orion-ejb-jar.xml from $OC4J_HOME/application-deployments/<application>/<Bean>.jar/ and then deploy it either manually or with JDeveloper. I hope it will help.
-
JDeveloper / OC4J rewriting my orion-ejb-jar.xml
Hi All.
Im having a play around with OC4J and CMP entity beans and struts at the moment learning some stuff for a new job, so ive started to write a little test app to get used to things.
Ive created a CMP entity - CustomerEntityEJB, manually defined the tables etc wrote and built it using JDeveloper 10.
Ive created all the necessary classes and descriptors in JDeveloper and the bean compiles and deploys fine, however no matter what i do, the table attribute of the <entity-deployment> elemnt is ALWAYS removed from the orion-ejb-jar.xml file before its deployed and i have no idea why.
Here are some snippets form the xml config files im using....
ejb-jar.xml :
<entity>
<description>Entity Bean ( CMP )</description>
<display-name>CustomerEntityEJB</display-name>
<ejb-name>CustomerEntityEJB</ejb-name>
<local-home>com.gb.ejb.entity.customer.CustomerEntityEJBLocalHome</local-home>
<local>com.gb.ejb.entity.customer.CustomerEntityEJBLocal</local>
<ejb-class>com.gb.ejb.entity.customer.CustomerEntityEJBBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>CustomerEntityEJB</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>title</field-name>
</cmp-field>
<cmp-field>
<field-name>forename</field-name>
</cmp-field>
<cmp-field>
<field-name>surname</field-name>
</cmp-field>
<cmp-field>
<field-name>email</field-name>
</cmp-field>
<cmp-field>
<field-name>password</field-name>
</cmp-field>
<cmp-field>
<field-name>active</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params/>
</query-method>
<ejb-ql>SELECT OBJECT(c) FROM CustomerEntityEJB c</ejb-ql>
</query>
</entity>
orion-ejb-jar.xml as in JDeveloper:
<?xml version = '1.0' encoding = 'windows-1252'?>
<orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd" schema-major-version="10" schema-minor-version="0">
<enterprise-beans>
<persistence-manager name="toplink"/>
<session-deployment name="CustomerSessionEJB" local-location="CustomerSessionEJB" />
<entity-deployment name="CustomerEntityEJB" data-source="jdbc/PostgresDS" table="Customer" local-location="CustomerEntityEJB">
<primkey-mapping>
<cmp-field-mapping name="id"/>
</primkey-mapping>
<cmp-field-mapping name="active"/>
<cmp-field-mapping name="email"/>
<cmp-field-mapping name="forename"/>
<cmp-field-mapping name="id"/>
<cmp-field-mapping name="password"/>
<cmp-field-mapping name="surname"/>
<cmp-field-mapping name="title"/>
</entity-deployment>
</enterprise-beans>
</orion-ejb-jar>
orion-ejb-jar.xml as viewed in the OC4J enterprise manager.
<?xml version="1.0" encoding="utf-8"?>
<orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd" deployment-version="10.1.3.3.0" deployment-time="1151415a0e3" schema-major-version="10" schema-minor-version="0" >
<enterprise-beans>
<persistence-manager name="toplink" class="oracle.toplink.internal.ejb.cmp.oc4j.Oc4jPersistenceManager" descriptor="toplink-ejb-jar.xml">
</persistence-manager>
<session-deployment name="CustomerSessionEJB" location="CustomerSessionEJB" local-location="CustomerSessionEJB" persistence-filename="CustomerSessionEJB">
<ejb-ref-mapping name="ejb/local/CustomerEntityEJB" location="TWA-EJB_CustomerEntityEJBLocal" />
</session-deployment>
<entity-deployment name="CustomerEntityEJB" location="CustomerEntityEJB" local-location="CustomerEntityEJB" concrete-bean-class="CustomerEntityEJB_ConcreteSubClass3" data-source="jdbc/PostgresDS" local-wrapper="CustomerEntityEJBLocalHome_LocalEntityHomeWrapper5">
</entity-deployment>
</enterprise-beans>
<assembly-descriptor>
<default-method-access>
<security-role-mapping name="<default-ejb-caller-role>" impliesAll="true" />
</default-method-access>
</assembly-descriptor>
</orion-ejb-jar>
As you can see, the orion-ejb-jar.xml that been deployed on the server has had extra attributes defined in it (like concrete-bean-class) which makessense - its adding in the bits i didnt to get th bean to deploy - however the table attribue is just removed, meaning my bean cant find the table - hence my app not working.
i just dont know how to stop this and would be extremely grateful if someone could give me a clue how to get my bean up and working properly as this is driving me insane.
Thanks in advance..
Gareth.sorted - the <persistence-manager name="toplink"/> element was automatically generated by JDeveloper and put in my orion-ejb-jar.xml appears to be un necessary and seemed to be breaking eveything - as soon as i removed it, the bean seemed to deploy ok and pick up the table name =]
as a bit of an aside does anyone know why it was automatically put there in the first place if it breaks things? -
A cmr-field and a cmp-field on the bean are using the same name. The names
Hi:
I am using weblogic 8.1 and MyEclipse 5.1.1. I am deploying my ear application through MyEclipse 5.1.1 as an ear file.
When I ran the following EJB QL:
SELECT OBJECT(p) FROM Product p.category = ?1
I get the following error:
n relation Category-Product, a cmr-field and a cmp-field on the bean are using the same name. The names of cmr and cmp fields must be unique.
It is basically complaining that I have a field
<cmr-field>
<cmr-field-name>category</cmr-field-name>
</cmr-field>
in my ejb-jar.xml and also the same category in the
<cmp-field><field-name>category</field-name></cmp-field>
field. The problem is that if I changed the value of the cmr-field, I have to add a get and set in my productLocal.java and when you do that you have to do the same in the ejb-jar.xml.
Here is my ejb-jar.xml:
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>CategoryEJB</ejb-name>
<local-home>com.CategoryHomeLocal</local-home>
<local>com.CategoryLocal</local>
<ejb-class>com.CategoryBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Category</abstract-schema-name>
<cmp-field><field-name>categoryId</field-name></cmp-field>
<cmp-field><field-name>categoryName</field-name></cmp-field>
<cmp-field><field-name>picture</field-name></cmp-field>
<cmp-field><field-name>pictureWidth</field-name></cmp-field>
<cmp-field><field-name>pictureHeight</field-name></cmp-field>
<cmp-field><field-name>labelOn</field-name></cmp-field>
<cmp-field><field-name>labelOff</field-name></cmp-field>
<cmp-field><field-name>button</field-name></cmp-field>
<primkey-field>categoryId</primkey-field>
<security-identity><use-caller-identity/></security-identity>
<query>
<query-method>
<method-name>findCategory</method-name>
<method-params></method-params>
</query-method>
<ejb-ql>
SELECT OBJECT(c) FROM Category c
</ejb-ql>
</query>
</entity>
<entity>
<ejb-name>ProductEJB</ejb-name>
<local-home>com.ProductHomeLocal</local-home>
<local>com.ProductLocal</local>
<ejb-class>com.ProductBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Product</abstract-schema-name>
<cmp-field><field-name>productId</field-name></cmp-field>
<cmp-field><field-name>brandName</field-name></cmp-field>
<cmp-field><field-name>productDescription</field-name></cmp-field>
<cmp-field><field-name>purchasePrice</field-name></cmp-field>
<cmp-field><field-name>category</field-name></cmp-field>
<primkey-field>productId</primkey-field>
<security-identity><use-caller-identity/></security-identity>
<query>
<query-method>
<method-name>findProduct</method-name>
<method-params>
<method-param>com.CategoryLocal</method-param>
</method-params>
</query-method>
<ejb-ql>
SELECT OBJECT(p) FROM Product p.category = ?1
</ejb-ql>
</query>
</entity>
</enterprise-beans>
<relationships>
<ejb-relation>
<ejb-relation-name>Category-Product</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>
Category-has-many-Product-numbers
</ejb-relationship-role-name>
<multiplicity>one</multiplicity>
<relationship-role-source>
<ejb-name>CategoryEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>productNumbers</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>
Product-belongs-to-Category
</ejb-relationship-role-name>
<multiplicity>many</multiplicity>
<cascade-delete/>
<relationship-role-source>
<ejb-name>ProductEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>category</cmr-field-name>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
</relationships>
<assembly-descriptor>
<security-role>
<role-name>Employees</role-name>
</security-role>
<method-permission>
<role-name>Employees</role-name>
<method>
<ejb-name>CategoryEJB</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>CategoryEJB</ejb-name>
<method-name>*</method-name>
</method>
<method>
<ejb-name>ProductEJB</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
Here is my weblogic-cmp-rdbms-jar.xml:
<!DOCTYPE weblogic-rdbms-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms20-persistence-810.dtd'>
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>CategoryEJB</ejb-name>
<data-source-name>ShoeStore</data-source-name>
<table-map>
<table-name>category</table-name>
<field-map>
<cmp-field>categoryId</cmp-field>
<dbms-column>categoryID</dbms-column>
</field-map>
<field-map>
<cmp-field>categoryName</cmp-field>
<dbms-column>categoryName</dbms-column>
</field-map>
<field-map>
<cmp-field>picture</cmp-field>
<dbms-column>Picture</dbms-column>
</field-map>
<field-map>
<cmp-field>pictureWidth</cmp-field>
<dbms-column>PictureWidth</dbms-column>
</field-map>
<field-map>
<cmp-field>pictureHeight</cmp-field>
<dbms-column>PictureHeight</dbms-column>
</field-map>
<field-map>
<cmp-field>labelOn</cmp-field>
<dbms-column>LabelOn</dbms-column>
</field-map>
<field-map>
<cmp-field>labelOff</cmp-field>
<dbms-column>LabelOff</dbms-column>
</field-map>
<field-map>
<cmp-field>button</cmp-field>
<dbms-column>Button</dbms-column>
</field-map>
</table-map>
<automatic-key-generation>
<generator-type>SQL_SERVER</generator-type>
</automatic-key-generation>
</weblogic-rdbms-bean>
<weblogic-rdbms-bean>
<ejb-name>ProductEJB</ejb-name>
<data-source-name>ShoeStore</data-source-name>
<table-map>
<table-name>PRODUCT</table-name>
<field-map>
<cmp-field>productId</cmp-field>
<dbms-column>productId</dbms-column>
</field-map>
<field-map>
<cmp-field>brandName</cmp-field>
<dbms-column>brandName</dbms-column>
</field-map>
<field-map>
<cmp-field>productDescription</cmp-field>
<dbms-column>productDescription</dbms-column>
</field-map>
<field-map>
<cmp-field>purchasePrice</cmp-field>
<dbms-column>purchasePrice</dbms-column>
</field-map>
<field-map>
<cmp-field>category</cmp-field>
<dbms-column>categoryId</dbms-column>
</field-map>
</table-map>
<!-- Automatically generate the value of ID in the database on inserts using sequence table -->
<automatic-key-generation>
<generator-type>SQL_SERVER</generator-type>
</automatic-key-generation>
</weblogic-rdbms-bean>
<weblogic-rdbms-relation>
<relation-name>Category-Product</relation-name>
<weblogic-relationship-role>
<relationship-role-name>Product-belongs-to-Category</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>categoryId</foreign-key-column>
<key-column>categoryID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
</weblogic-rdbms-jar>
Here is my productLocal.java:
package com;
import javax.ejb.CreateException;
import javax.naming.NamingException;
import java.util.Date;
import java.util.Vector;
import java.util.Collection;
public interface ProductLocal extends javax.ejb.EJBLocalObject
public Integer getProductId();
public void setProductId(Integer productId);
public String getBrandName();
public void setBrandName(String brandName);
public String getProductDescription();
public void setProductDescription(String productDescription);
public Double getPurchasePrice();
public void setPurchasePrice(Double purchasePrice);
public CategoryLocal getCategory();
public void setCategory(CategoryLocal category);
Here is my ProductBean.java:
package com;
import javax.naming.InitialContext;
import javax.ejb.EntityContext;
import javax.ejb.CreateException;
import javax.naming.NamingException;
import java.util.Date;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;
import java.lang.Integer;
public abstract class ProductBean implements javax.ejb.EntityBean
public Integer ejbCreate(Integer id)
this.setProductId(id);
return null;
public void ejbPostCreate(Integer id)
//public abstract Integer getCategoryId();
// public abstract void setCategoryId(Integer categoryId);
public abstract CategoryLocal getCategory();
public abstract void setCategory(CategoryLocal category);
public abstract Integer getProductId();
public abstract void setProductId(Integer productId);
public abstract String getBrandName();
public abstract void setBrandName(String brandName);
public abstract String getProductDescription();
public abstract void setProductDescription(String productDescription);
public abstract Double getPurchasePrice();
public abstract void setPurchasePrice(Double purchasePrice);
public void setEntityContext(EntityContext ec)
System.out.println("ProductBean setEntityContext");
public void unsetEntityContext()
System.out.println("ProductBean unsetEntityContext");
public void ejbLoad()
System.out.println("ProductBean ejbLoad");
public void ejbStore()
System.out.println("ProductBean ejbStore");
public void ejbActivate()
System.out.println("ProductBean ejbActivate");
public void ejbPassivate()
System.out.println("ProductBean ejbPassivate");
public void ejbRemove()
System.out.println("ProductBean ejbRemove");
What do I needed to do to fix this problem.
Any hint or help would be greatly appreciated!!!
Yours,
Frustratedcmr field which is "category" in ur mapping , u can't use as cmp field in abstract schema mapping. just remove category from cmp field . and every thing is fine
-
All cmp-fields that double as cmr-fields must have an object type??
Greetings,
I'm deploying an application in weblogic 8.1sp2 that worked fine in
jboss 3.2. The error is:
Exception:weblogic.management.ApplicationException: prepare failed for
ServiceEJB.jar Module: ServiceEJB.jar Error: Exception preparing module:
EJBModule(ServiceEJB.jar,status=NEW) Unable to deploy EJB:
ServiceEJB.jar from ServiceEJB.jar: [EJB:011017]Error while reading
'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was: In relationship
'primitive_TO_primitive_param', role
'primitive_param_BELONGS_TO_primitive', a cmp-field used to implement
this relationship has a primitive type. All cmp-fields that double as
cmr-fields must have an object type. . at
weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:255) at
Does it means that I should cmp field from "int" type to "Integer"
object??? If true, I really don't know why the requirement since in
jboss worked just fine. But do you confirm it?
regards,
Pedro SalazarI believe there is a requirement that any field used as a primary or
foreign key must be an object and implement hashCode/equals.
I'd post in weblogic.developer.interest.ejb.cmp if you want more
information.
-- Rob
Pedro Salazar wrote:
Greetings,
I'm deploying an application in weblogic 8.1sp2 that worked fine in
jboss 3.2. The error is:
Exception:weblogic.management.ApplicationException: prepare failed for
ServiceEJB.jar Module: ServiceEJB.jar Error: Exception preparing module:
EJBModule(ServiceEJB.jar,status=NEW) Unable to deploy EJB:
ServiceEJB.jar from ServiceEJB.jar: [EJB:011017]Error while reading
'META-INF/weblogic-cmp-rdbms-jar.xml'. The error was: In relationship
'primitive_TO_primitive_param', role
'primitive_param_BELONGS_TO_primitive', a cmp-field used to implement
this relationship has a primitive type. All cmp-fields that double as
cmr-fields must have an object type. . at
weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:255) at
Does it means that I should cmp field from "int" type to "Integer"
object??? If true, I really don't know why the requirement since in
jboss worked just fine. But do you confirm it?
regards,
Pedro Salazar -
Beginner needs help with CMR field problem
Hello,
I have two ejbs, one called EstablishmentEJB and another called VisitorCommentsEJB. The relationship is of one EstablishmentEJB instance to many VisitorCommentsEJB instances.
Here are the definitions for the tables:
CREATE TABLE establishments (
DB_ESTABLISHMENT_ID int(11) NOT NULL default '0',
DB_POSTCODE varchar(100) NOT NULL default '',
DB_ESTABLISHMENT_NAME varchar(255) NOT NULL default '',
PRIMARY KEY (DB_ESTABLISHMENT_ID)
) TYPE=InnoDB;
CREATE TABLE visitors_comments (
DB_VISITOR_COMMENT_ID int(11) NOT NULL auto_increment,
DB_ESTABLISHMENT_ID int(11) NOT NULL default '0',
DB_COMMENT varchar(255) NOT NULL default '',
PRIMARY KEY (DB_VISITOR_COMMENT_ID)
) TYPE=InnoDB;Here are the xml DDs:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
-->
<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">
<description>test guide</description>
<display-name>test guide</display-name>
<enterprise-beans>
<!--===========Establishment================ -->
<entity>
<ejb-name>EstablishmentEJB</ejb-name>
<home>com.softwareag.test_guide.establishmentEJB.PGEstablishmentHome</home>
<remote>com.softwareag.test_guide.establishmentEJB.PGEstablishment</remote>
<local-home>com.softwareag.test_guide.establishmentEJB.PGEstablishmentLocalHome</local-home>
<local>com.softwareag.test_guide.establishmentEJB.PGEstablishmentLocal</local>
<ejb-class>com.softwareag.test_guide.establishmentEJB.PGEstablishmentBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Establishment</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<!--===========Grade================ -->
<entity>
<ejb-name>GradeEJB</ejb-name>
<home>com.softwareag.test_guide.gradeEJB.PGGradeHome</home>
<remote>com.softwareag.test_guide.gradeEJB.PGGrade</remote>
<local-home>com.softwareag.test_guide.gradeEJB.PGGradeLocalHome</local-home>
<local>com.softwareag.test_guide.gradeEJB.PGGradeLocal</local>
<ejb-class>com.softwareag.test_guide.gradeEJB.PGGradeBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Grade</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>grade</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<!--===========VisitorsComment================ -->
<entity>
<ejb-name>VisitorCommentEJB</ejb-name>
<home>com.softwareag.test_guide.visitorCommentEJB.PGVisitorCommentHome</home>
<remote>com.softwareag.test_guide.visitorCommentEJB.PGVisitorComment</remote>
<local-home>com.softwareag.test_guide.visitorCommentEJB.PGVisitorCommentLocalHome</local-home>
<local>com.softwareag.test_guide.visitorCommentEJB.PGVisitorCommentLocal</local>
<ejb-class>com.softwareag.test_guide.visitorCommentEJB.PGVisitorCommentBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>VisitorsComment</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>comment</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<!--===========Country================ -->
<entity>
<ejb-name>CountryEJB</ejb-name>
<home>com.softwareag.test_guide.countryEJB.PGCountryHome</home>
<remote>com.softwareag.test_guide.countryEJB.PGCountry</remote>
<local-home>com.softwareag.test_guide.countryEJB.PGCountryLocalHome</local-home>
<local>com.softwareag.test_guide.countryEJB.PGCountryLocal</local>
<ejb-class>com.softwareag.test_guide.countryEJB.PGCountryBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Country</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>countryName</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<!--===========Category================ -->
<entity>
<ejb-name>CategoryEJB</ejb-name>
<home>com.softwareag.test_guide.categoryEJB.PGCategoryHome</home>
<remote>com.softwareag.test_guide.categoryEJB.PGCategory</remote>
<local-home>com.softwareag.test_guide.categoryEJB.PGCategoryLocalHome</local-home>
<local>com.softwareag.test_guide.categoryEJB.PGCategoryLocal</local>
<ejb-class>com.softwareag.test_guide.categoryEJB.PGCategoryBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>false</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>Category</abstract-schema-name>
<cmp-field>
<field-name>id</field-name>
</cmp-field>
<cmp-field>
<field-name>category</field-name>
</cmp-field>
<primkey-field>id</primkey-field>
</entity>
<!--===========SearchEngineValueListHandler================ -->
<session>
<ejb-name>PGSearchEngineValueListHandlerEJB</ejb-name>
<home>com.softwareag.test_guide.searchEngineEJB.PGSearchEngineValueListHandlerHome</home>
<remote>com.softwareag.test_guide.searchEngineEJB.PGSearchEngineValueListHandler</remote>
<local-home>com.softwareag.test_guide.searchEngineEJB.PGSearchEngineValueListHandlerLocalHome</local-home>
<local>com.softwareag.test_guide.searchEngineEJB.PGSearchEngineValueListHandlerLocal</local>
<ejb-class>com.softwareag.test_guide.searchEngineEJB.PGSearchEngineValueListHandlerBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/test_guia</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
</session>
<!--===========SessionFacade================ -->
<session>
<ejb-name>PGSessionFacadeEJB</ejb-name>
<home>com.softwareag.test_guide.sessionFacadeEJB.PGSessionFacadeHome</home>
<remote>com.softwareag.test_guide.sessionFacadeEJB.PGSessionFacade</remote>
<local-home>com.softwareag.test_guide.sessionFacadeEJB.PGSessionFacadeLocalHome</local-home>
<local>com.softwareag.test_guide.sessionFacadeEJB.PGSessionFacadeLocal</local>
<ejb-class>com.softwareag.test_guide.sessionFacadeEJB.PGSessionFacadeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/test_guia</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
</resource-ref>
</session>
</enterprise-beans>
<relationships>
<!--===========Establishments-VisitorComments================-->
<ejb-relation>
<ejb-relation-name>Establishment-VisitorComment</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Establishment-has-many-comments</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>EstablishmentEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>visitorComments</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Comment-belongs-to-Establishment</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>VisitorCommentEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
<!--===========Establishments-Grades================-->
<ejb-relation>
<ejb-relation-name>Establishment-Grade</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Establishment-has-many-grades</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source>
<ejb-name>EstablishmentEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>grades</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Grade-belongs-to-Establishment</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>GradeEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
<!--===========Establishments-Countries================-->
<ejb-relation>
<ejb-relation-name>Country-Establishment</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Country-has-many-establishments</ejb-relationship-role-name>
<!--========== One or Many here?? ==========-->
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>CountryEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Establishment-has-many-countries</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>EstablishmentEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>countries</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
</ejb-relation>
<!--===========Establishments-Categories ================-->
<ejb-relation>
<ejb-relation-name>Establishment-Category</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Establishment-has-many-categories</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>EstablishmentEJB</ejb-name>
</relationship-role-source>
<cmr-field>
<cmr-field-name>categories</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Category-has-many-establishments</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<relationship-role-source>
<ejb-name>CategoryEJB</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>
</ejb-jar>
<?xml version="1.0" encoding="ISO-8859-1"?>
<jonas-ejb-jar xmlns="http://www.objectweb.org/jonas/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.objectweb.org/jonas/ns
http://www.objectweb.org/jonas/ns/jonas-ejb-jar_4_0.xsd" >
<!--
<!DOCTYPE jonas-ejb-jar PUBLIC "-//ObjectWeb//DTD JOnAS 3.2//EN" "http://www.objectweb.org/jonas/dtds/jonas-ejb-jar_3_2.dtd">
<jonas-ejb-jar>
-->
<!-- ===============SearchEngineValueListHandler=======================-->
<jonas-session>
<ejb-name>PGSearchEngineValueListHandlerEJB</ejb-name>
<jndi-name>PGSearchEngineValueListHandlerEJBHome</jndi-name>
<jonas-resource>
<res-ref-name>jdbc/test_guia</res-ref-name>
<jndi-name>test_guia</jndi-name>
</jonas-resource>
</jonas-session>
<!-- ===============SessionFacade=======================-->
<jonas-session>
<ejb-name>PGSessionFacadeEJB</ejb-name>
<jndi-name>PGSessionFacadeEJBHome</jndi-name>
<jonas-resource>
<res-ref-name>jdbc/test_guia</res-ref-name>
<jndi-name>test_guia</jndi-name>
</jonas-resource>
</jonas-session>
<!-- ===============Establishment=======================-->
<jonas-entity>
<ejb-name>EstablishmentEJB</ejb-name>
<jndi-name>PGEstablishmentHome</jndi-name>
<cleanup>none</cleanup>
<jdbc-mapping>
<jndi-name>test_guia</jndi-name>
<jdbc-table-name>ESTABLISHMENTS</jdbc-table-name>
<cmp-field-jdbc-mapping>
<field-name>id</field-name>
<jdbc-field-name>DB_ESTABLISHMENT_ID</jdbc-field-name>
</cmp-field-jdbc-mapping>
<cmp-field-jdbc-mapping>
<field-name>name</field-name>
<jdbc-field-name>DB_ESTABLISHMENT_NAME</jdbc-field-name>
</cmp-field-jdbc-mapping>
</jdbc-mapping>
</jonas-entity>
<!-- ===============Grade=======================-->
<jonas-entity>
<ejb-name>GradeEJB</ejb-name>
<jndi-name>PGgradeHome</jndi-name>
<cleanup>none</cleanup>
<jdbc-mapping>
<jndi-name>test_guia</jndi-name>
<jdbc-table-name>GRADES</jdbc-table-name>
<cmp-field-jdbc-mapping>
<field-name>id</field-name>
<jdbc-field-name>DB_GRADE_ID</jdbc-field-name>
</cmp-field-jdbc-mapping>
<cmp-field-jdbc-mapping>
<field-name>grade</field-name>
<jdbc-field-name>DB_GRADE</jdbc-field-name>
</cmp-field-jdbc-mapping>
<!--
<cmp-field-jdbc-mapping>
<field-name>establishment_id</field-name>
<jdbc-field-name>DB_ESTABLISHMENT_ID</jdbc-field-name>
</cmp-field-jdbc-mapping>
-->
</jdbc-mapping>
</jonas-entity>
<!-- ===============Visitor�s comments=======================-->
<jonas-entity>
<ejb-name>VisitorCommentEJB</ejb-name>
<jndi-name>PGVisitorCommentHome</jndi-name>
<cleanup>none</cleanup>
<jdbc-mapping>
<jndi-name>test_guia</jndi-name>
<jdbc-table-name>VISITORS_COMMENTS</jdbc-table-name>
<cmp-field-jdbc-mapping>
<field-name>id</field-name>
<jdbc-field-name>DB_VISITOR_COMMENT_ID</jdbc-field-name>
</cmp-field-jdbc-mapping>
<cmp-field-jdbc-mapping>
<field-name>comment</field-name>
<jdbc-field-name>DB_COMMENT</jdbc-field-name>
</cmp-field-jdbc-mapping>
<!--
<cmp-field-jdbc-mapping>
<field-name>establishment_id</field-name>
<jdbc-field-name>DB_ESTABLISHMENT_ID</jdbc-field-name>
</cmp-field-jdbc-mapping>
-->
</jdbc-mapping>
</jonas-entity>
<!-- ===============Countries=======================-->
<jonas-entity>
<ejb-name>CountryEJB</ejb-name>
<jndi-name>PGcountryHome</jndi-name>
<cleanup>none</cleanup>
<jdbc-mapping>
<jndi-name>test_guia</jndi-name>
<jdbc-table-name>COUNTRIES</jdbc-table-name>
<cmp-field-jdbc-mapping>
<field-name>id</field-name>
<jdbc-field-name>DB_COUNTRY_ID</jdbc-field-name>
</cmp-field-jdbc-mapping>
<cmp-field-jdbc-mapping>
<field-name>countryName</field-name>
<jdbc-field-name>DB_COUNTRY_NAME_FR</jdbc-field-name>
</cmp-field-jdbc-mapping>
</jdbc-mapping>
</jonas-entity>
<!-- ===============Categories=======================-->
<jonas-entity>
<ejb-name>CategoryEJB</ejb-name>
<jndi-name>PGcategoryHome</jndi-name>
<cleanup>none</cleanup>
<jdbc-mapping>
<jndi-name>test_guia</jndi-name>
<jdbc-table-name>CATEGORIES</jdbc-table-name>
<cmp-field-jdbc-mapping>
<field-name>id</field-name>
<jdbc-field-name>DB_CATEGORY_ID</jdbc-field-name>
</cmp-field-jdbc-mapping>
<cmp-field-jdbc-mapping>
<field-name>category</field-name>
<jdbc-field-name>DB_CATEGORY_NAME_FR</jdbc-field-name>
</cmp-field-jdbc-mapping>
</jdbc-mapping>
</jonas-entity>
<!--===========Establishments-VisitorComments================-->
<jonas-ejb-relation>
<ejb-relation-name>Establishment-VisitorComment</ejb-relation-name>
<jonas-ejb-relationship-role>
<ejb-relationship-role-name>Comment-belongs-to-Establishment</ejb-relationship-role-name>
<foreign-key-jdbc-mapping>
<foreign-key-jdbc-name>DB_ESTABLISHMENT_ID</foreign-key-jdbc-name>
</foreign-key-jdbc-mapping>
</jonas-ejb-relationship-role>
</jonas-ejb-relation>
<!--===========Establishments-Grades================-->
<jonas-ejb-relation>
<ejb-relation-name>Establishment-Grade</ejb-relation-name>
<jonas-ejb-relationship-role>
<ejb-relationship-role-name>Grade-belongs-to-Establishment</ejb-relationship-role-name>
<foreign-key-jdbc-mapping>
<foreign-key-jdbc-name>DB_ESTABLISHMENT_ID</foreign-key-jdbc-name>
</foreign-key-jdbc-mapping>
</jonas-ejb-relationship-role>
</jonas-ejb-relation>
<!--===========Establishments-Countries================-->
<jonas-ejb-relation>
<ejb-relation-name>Country-Establishment</ejb-relation-name>
<jdbc-table-name>COUNTRIES_ESTABLISHMENTS</jdbc-table-name>
<jonas-ejb-relationship-role>
<ejb-relationship-role-name>Country-has-many-establishments</ejb-relationship-role-name>
<foreign-key-jdbc-mapping>
<foreign-key-jdbc-name>DB_ESTABLISHMENT_ID</foreign-key-jdbc-name>
</foreign-key-jdbc-mapping>
</jonas-ejb-relationship-role>
<jonas-ejb-relationship-role>
<ejb-relationship-role-name>Establishment-has-many-countries</ejb-relationship-role-name>
<foreign-key-jdbc-mapping>
<foreign-key-jdbc-name>DB_COUNTRY_ID</foreign-key-jdbc-name>
</foreign-key-jdbc-mapping>
</jonas-ejb-relationship-role>
</jonas-ejb-relation>
<!--===========Establishments-Categories ================-->
<jonas-ejb-relation>
<ejb-relation-name>Establishment-Category</ejb-relation-name>
<jdbc-table-name>ESTABLISHMENTS_CATEGORIES</jdbc-table-name>
<jonas-ejb-relationship-role>
<ejb-relationship-role-name>Establishment-has-many-categories</ejb-relationship-role-name>
<foreign-key-jdbc-mapping>
<foreign-key-jdbc-name>DB_CATEGORY_ID</foreign-key-jdbc-name>
</foreign-key-jdbc-mapping>
</jonas-ejb-relationship-role>
<jonas-ejb-relationship-role>
<ejb-relationship-role-name>Category-has-many-establishments</ejb-relationship-role-name>
<foreign-key-jdbc-mapping>
<foreign-key-jdbc-name>DB_ESTABLISHMENT_ID</foreign-key-jdbc-name>
</foreign-key-jdbc-mapping>
</jonas-ejb-relationship-role>
</jonas-ejb-relation>
</jonas-ejb-jar>Here are the two classes for the beans
package com.softwareag.test_guide.establishmentEJB;
import java.util.Collection;
import java.util.Iterator;
import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
import com.softwareag.test_guide.ejb.util.PGServiceLocator;
import com.softwareag.test_guide.ejb.util.PGServiceLocatorException;
import com.softwareag.test_guide.gradeEJB.PGGradeLocal;
import com.softwareag.test_guide.visitorCommentEJB.PGVisitorCommentLocal;
import com.softwareag.test_guide.visitorCommentEJB.PGVisitorCommentLocalHome;
* @author Julien Martin
public abstract class PGEstablishmentBean implements EntityBean {
public Integer ejbCreate(
Integer id,
String name,
Collection visitorComments,
Collection grades,
Collection countries,
Collection categories)
throws CreateException {
setId(id);
setName(name);
setVisitorComments(visitorComments);
setGrades(grades);
return null;
public void ejbPostCreate(
Integer id,
String name,
Collection visitorComments,
Collection grades,
Collection countries,
Collection categories) {
setCountries(countries);
setCategories(categories);
//Business methods
public int getAverageGrade() {
Collection grades = this.getGrades();
if (grades.size() == 0) {
return 0;
} else {
Iterator iterator = grades.iterator();
int total = 0;
while (iterator.hasNext()) {
PGGradeLocal pGGradeLocal = (PGGradeLocal) iterator.next();
Integer amount = pGGradeLocal.getGrade();
total = total + amount.intValue();
float average = total / grades.size();
int roundedAverage = Math.round(average);
return roundedAverage;
public void addComment(Integer id, String comment) {
try {
PGVisitorCommentLocalHome pGcommentHome =
(PGVisitorCommentLocalHome) PGServiceLocator.getInstance().getLocalHome("PGVisitorCommentHome_L");
PGVisitorCommentLocal pGcomment = pGcommentHome.create(id, comment);
Collection pGcomments = this.getVisitorComments();
pGcomments.add(pGcomment);
} catch (PGServiceLocatorException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
//Persistence fields
public abstract Integer getId();
public abstract void setId(Integer id);
public abstract String getName();
public abstract void setName(String name);
//Relation fields
public abstract Collection getVisitorComments();
public abstract void setVisitorComments(Collection visitorComments);
public abstract Collection getGrades();
public abstract void setGrades(Collection grades);
public abstract Collection getCountries();
public abstract void setCountries(Collection countries);
public abstract Collection getCategories();
public abstract void setCategories(Collection categories);
//Callback methods
public void setEntityContext(EntityContext ec) {
public void unsetEntityContext() {
public void ejbLoad() {
public void ejbStore() {
public void ejbActivate() {
public void ejbPassivate() {
public void ejbRemove() throws RemoveException {
package com.softwareag.test_guide.visitorCommentEJB;
import javax.ejb.CreateException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
* @author Julien Martin
public abstract class PGVisitorCommentBean implements EntityBean {
public Integer ejbCreate(Integer id, String comment)throws CreateException {
setId(id);
setComment(comment);
return null;
public void ejbPostCreate(Integer id, String comment) {}
//Persistence fields
public abstract Integer getId();
public abstract void setId(Integer id);
public abstract String getComment();
public abstract void setComment(String comment);
// public abstract Integer getEstablishment_id();
// public abstract void setEstablishment_id(Integer establishment_id);
//Callback methods
public void setEntityContext(EntityContext ec) {}
public void unsetEntityContext() {}
public void ejbLoad() {}
public void ejbStore() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbRemove() throws RemoveException {}
}I get the following error from MYSQL:
22:57:10,203 : JOnASVisitorCommentEJBBean.ejbPostCreate : Failed to create bean:
java.sql.SQLException: General error, message from server: "Column 'DB_ESTABLISHMENT_ID' cannot be null"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1626)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
at com.mysql.jdbc.Connection.execSQL(Connection.java:1844)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1602)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1488)
at jorm.rdb.mysql.VisitorsCommentBinding.insertVISITORS_COMMENTSTable(VisitorsCommentBinding.java:558)
at jorm.rdb.mysql.VisitorsCommentBinding.write(VisitorsCommentBinding.java:147)
at com.softwareag.test_guide.visitorCommentEJB.JOnASVisitorCommentEJBBean.ejbPostCreate(JOnASVisitorCommentEJBBean.java:283)
at com.softwareag.test_guide.visitorCommentEJB.JOnASVisitorCommentEJBLocalHome.create(JOnASVisitorCommentEJBLocalHome.java:76)
at com.softwareag.test_guide.establishmentEJB.PGEstablishmentBean.addComment(PGEstablishmentBean.java:71)
at com.softwareag.test_guide.establishmentEJB.JOnASEstablishmentEJBLocal.addComment(JOnASEstablishmentEJBLocal.java:170)
at com.softwareag.test_guide.sessionFacadeEJB.PGSessionFacadeBean.addComment(PGSessionFacadeBean.java:80)
at com.softwareag.test_guide.sessionFacadeEJB.JOnASPGSessionFacadeEJBLocal.addComment(JOnASPGSessionFacadeEJBLocal.java:168)
at com.softwareag.test_guide.web.temp.PGBusinessDelegate.addComment(PGBusinessDelegate.java:93)
at com.softwareag.test_guide.web.temp.PGCommentsManagedBean.addCommentAction(PGCommentsManagedBean.java:13)
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)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at sun.reflect.GeneratedMethodAccessor208.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:241)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:499)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:263)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:140)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:136)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Thread.java:536)
22:57:10,203 : JFactory.postInvoke : system exception in business method:
javax.ejb.EJBException: Failed to create bean: General error, message from server: "Column 'DB_ESTABLISHMENT_ID' cannot be null"
at com.softwareag.test_guide.visitorCommentEJB.JOnASVisitorCommentEJBBean.ejbPostCreate(JOnASVisitorCommentEJBBean.java:288)
at com.softwareag.test_guide.visitorCommentEJB.JOnASVisitorCommentEJBLocalHome.create(JOnASVisitorCommentEJBLocalHome.java:76)
at com.softwareag.test_guide.establishmentEJB.PGEstablishmentBean.addComment(PGEstablishmentBean.java:71)
at com.softwareag.test_guide.establishmentEJB.JOnASEstablishmentEJBLocal.addComment(JOnASEstablishmentEJBLocal.java:170)
at com.softwareag.test_guide.sessionFacadeEJB.PGSessionFacadeBean.addComment(PGSessionFacadeBean.java:80)
at com.softwareag.test_guide.sessionFacadeEJB.JOnASPGSessionFacadeEJBLocal.addComment(JOnASPGSessionFacadeEJBLocal.java:168)
at com.softwareag.test_guide.web.temp.PGBusinessDelegate.addComment(PGBusinessDelegate.java:93)
at com.softwareag.test_guide.web.temp.PGCommentsManagedBean.addCommentAction(PGCommentsThanks all for replying,
The error occurs when I run the client and not at deploy time. Here is the client code:
public void addComment(Integer primaryKey, String comment) {
System.out.println("primaryKey------>" + primaryKey);
try {
PGEstablishmentLocalHome establishmentHome = (PGEstablishmentLocalHome) PGServiceLocator.getInstance().getLocalHome("PGEstablishmentHome_L");
PGEstablishmentLocal establishmentLocal = establishmentHome.findByPrimaryKey(primaryKey);
establishmentLocal.addComment(primaryKey,comment);
} catch (PGServiceLocatorException e) {
e.printStackTrace();
} catch (FinderException e) {
e.printStackTrace();
u haven't defined the PK entry in the Establishment EJB Bean in DDYes look in the standard DD.
What's more I need both DD as I would with most ejb containers.
The field DB_ESTABLISHMENT_ID is required and I cannot set it to NULL.
Any other help greatly appreciated.
Julien Martin. -
Finder method to retrieve CMR field?
Hello all!
I have two entity EJBs - one named "Property" and another named "Merchandise".
Property has a one-to-many relationship to Merchandise, and Merchandise is a CMR
field (named "merchandise") in Property. Now I would like to write a finder method
for Property to retrieve the CMR field (Merchandise references). The finder method
is called "findDVD()". The ejb-ql is below:
SELECT DISTINCT OBJECT(merch) FROM Property AS p, IN(p.merchandise) AS merch
WHERE merch.starsMasterTitleId = ?1
AND merch.productTypeCode = 'VIDEO'
AND merch.format = 'DVD'
AND merch.active = 'Y'
AND merch.approved = 'Y'
AND merch.purchaseable = 'Y'
However, I can't seem to get this method to work. Weblogic's EJBC keeps complaining
that the returned collection MUST be of the method owner type - in other words,
I can't return Merchandise references, only Property references.
What am I doing wrong? Is this a limitation in CMR that I didn't know about? Please
help!
I am using WLS 6.1 with SP 1.
Thanks so much!
-BIf you are using ejb2.0 you can do this using a home method and select
method instead of a finder. Finders are limited to returning objects of the
type of ejb they belong to while select methods are not. Select methods
cannot be invoked directly by the clients so you need a home method to wrap
them.
-- Anand
"Brian Wang" <[email protected]> wrote in message
news:3ca3678d$[email protected]..
>
>
Hello all!
I have two entity EJBs - one named "Property" and another named"Merchandise".
Property has a one-to-many relationship to Merchandise, and Merchandise isa CMR
field (named "merchandise") in Property. Now I would like to write afinder method
for Property to retrieve the CMR field (Merchandise references). Thefinder method
is called "findDVD()". The ejb-ql is below:
SELECT DISTINCT OBJECT(merch) FROM Property AS p, IN(p.merchandise) ASmerch
WHERE merch.starsMasterTitleId = ?1
AND merch.productTypeCode = 'VIDEO'
AND merch.format = 'DVD'
AND merch.active = 'Y'
AND merch.approved = 'Y'
AND merch.purchaseable = 'Y'
However, I can't seem to get this method to work. Weblogic's EJBC keepscomplaining
that the returned collection MUST be of the method owner type - in otherwords,
I can't return Merchandise references, only Property references.
What am I doing wrong? Is this a limitation in CMR that I didn't knowabout? Please
help!
I am using WLS 6.1 with SP 1.
Thanks so much!
-B -
IllegalStateException for cmr-fields due to diff txns
Hi,
I am using cmp entity beans on WebLogic Server 7. Assume bean 'A' to bean 'B' is
1:M
I get the following exception while trying to create bean B -
<Exception in MyClass.createB(): javax.ejb.EJBException: EJB Exception:: java.lang.IllegalStateException:
Attempted to access the collection valued cmr-field, 'b', for bean, 'A', in a transaction
that is different than the transaction in which the collection was materialized.
All access to the collection must be performed during the transaction in which the
collection was initially retrieved.
I upgraded from 6.1 sp2 to 7 and got this exception. I never got it in wls 6.1 sp2.
Since my beans are cmp, the container handles all transactions and I have specified
<trans-attribute>Required</trans-attribute> in ejb-jar.xml.
How can I ensure that the container uses the same txn for accessing all cmr fields?
I will appreciate if anyone can point me in the right direction.
Thanks!I figured out the problem. The caller that calls methods on the entity bean interfaces
has to wrap the calls inside a transaction.
"Roy Lu" <[email protected]> wrote:
>
I am getting the exact same exception. Is this a bug or am I missing
something?
Thanks.
"A D" <[email protected]> wrote:
Hi,
I am using cmp entity beans on WebLogic Server 7. Assume bean 'A' to
bean 'B' is
1:M
I get the following exception while trying to create bean B -
<Exception in MyClass.createB(): javax.ejb.EJBException: EJB Exception::
java.lang.IllegalStateException:
Attempted to access the collection valued cmr-field, 'b', for bean,'A',
in a transaction
that is different than the transaction in which the collection was materialized.
All access to the collection must be performed during the transaction
in which the
collection was initially retrieved.
I upgraded from 6.1 sp2 to 7 and got this exception. I never got itin
wls 6.1 sp2.
Since my beans are cmp, the container handles all transactions and I
have specified
<trans-attribute>Required</trans-attribute> in ejb-jar.xml.
How can I ensure that the container uses the same txn for accessingall
cmr fields?
I will appreciate if anyone can point me in the right direction.
Thanks! -
Hi friends i am doing one small project using weblogic,ejb and mysql
When i try to retirive values from the table using CMR i am getting the error of
bolderrorAttempt to serialize a collection that implements a cmr-field. Collections managed by the CMP RDBMS persistence manager may not be passed directly to a remote client.*bold*
My EJBQL is
bold
**@ejb.finder
* query="SELECT OBJECT(a) FROM NeworderSCHEMA as a WHERE a.po_no = ?1"
* signature="java.util.Collection findByPo_noCMR(java.lang.String po_no)" bold
My Session Bean who is calling this is NeworderBean
bold
public java.util.Collection getAllPendingOrdersnew()
throws javax.naming.NamingException, javax.ejb.FinderException {
java.util.Collection pendorders = new java.util.ArrayList(); //to return all pending orders to web-client
java.util.ArrayList pendorder = null; //to put one pending order attributes to collection of pendorders
NeworderLocalHome home = NeworderUtil.getLocalHome();
NeworderLocal localObject = null;
java.util.Collection c = home.findByPo_noCMR("91");
//loop to take one pendingorderLocal at a time and populate pedningorders collection
for(java.util.Iterator i = c.iterator(); i.hasNext(); ){
//populating the arraylist with customer attributes
localObject = (NeworderLocal) i.next();
pendorder = new java.util.ArrayList();
pendorder.add(localObject.getPrimaryKey()); //index 0 -- stores the po_no
pendorder.add(localObject.getPo_date()); //index 1 -- stores the po_date
pendorder.add(localObject.getPo_status());//index 2 -- stores the po_status
pendorder.add(localObject.getPo_suppcode()); //index 3 -- stores the supplier code
pendorder.add(localObject.getUserid());//index 4 -- stores the user id
pendorder.add(localObject.getTimestamp());//index 5 -- stores the created date
pendorder.add(localObject.getItems());//for order detail table
//one customer data is filled. so, add this to customers arraylist
pendorders.add(pendorder);
//return the collection of all customers
return pendorders;
}*bold*
Please help meWhen i give with out @ejb-interface i am getting error of
Exception:weblogic.management.ApplicationException: Prepare failed. Task Id = 29
Module: New_OrderEJB.jar Error: [EJB:011024]The XML parser encountered an error in your deployment descriptor. Please ensure that your deployment descriptor corresponds to the format in the DTD. The error was:
Error parsing file 'META-INF/ejb-jar.xml' at line: 247 column: 26. XML document structures must start and end within the same entity..
ejb-jar.xml file content is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_1">
<description><![CDATA[New_OrderEJB generated by eclipse wtp xdoclet extension.]]></description>
<display-name>New_OrderEJB</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session id="Session_Head">
<description><![CDATA[An EJB named Head]]></description>
<display-name>Head</display-name>
<ejb-name>Head</ejb-name>
<home>order.headsess.HeadHome</home>
<remote>order.headsess.Head</remote>
<local-home>order.headsess.HeadLocalHome</local-home>
<local>order.headsess.HeadLocal</local>
<ejb-class>order.headsess.HeadSession</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<!--
To add session beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called session-beans.xml that contains
the <session></session> markup for those beans.
-->
<!-- Entity Beans -->
<entity id="ContainerManagedEntity_Neworder">
<description><![CDATA[<!-- begin-xdoclet-definition -->]]></description>
<ejb-name>Neworder</ejb-name>
<home>order.headentity.NeworderHome</home>
<remote>order.headentity.Neworder</remote>
<local-home>order.headentity.NeworderLocalHome</local-home>
<local>order.headentity.NeworderLocal</local>
<ejb-class>order.headentity.NeworderCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>NeworderSCHEMA</abstract-schema-name>
<cmp-field id="CMPAttribute_1">
<description><![CDATA[<!-- begin-user-doc --> CMP Field po_no Returns the po_no]]></description>
<field-name>po_no</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_2">
<description><![CDATA[<!-- begin-user-doc --> CMP Field po_date Returns the po_date]]></description>
<field-name>po_date</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_3">
<description><![CDATA[<!-- begin-user-doc --> CMP Field po_suppcode Returns the po_suppcode]]></description>
<field-name>po_suppcode</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_4">
<description><![CDATA[<!-- begin-user-doc --> CMP Field po_reference_no Returns the po_reference_no]]></description>
<field-name>po_reference_no</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_5">
<description><![CDATA[<!-- begin-user-doc --> CMP Field userid Returns the userid]]></description>
<field-name>userid</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_6">
<description><![CDATA[<!-- begin-user-doc --> CMP Field timestamp Returns the timestamp]]></description>
<field-name>timestamp</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_7">
<description><![CDATA[<!-- begin-user-doc --> CMP Field approved_by Returns the approved_by]]></description>
<field-name>approved_by</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_8">
<description><![CDATA[<!-- begin-user-doc --> CMP Field po_status Returns the po_status]]></description>
<field-name>po_status</field-name>
</cmp-field>
<primkey-field>po_no</primkey-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM NeworderSCHEMA as a]]></ejb-ql>
</query>
<query>
<query-method>
<method-name>findByStatus</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM NeworderSCHEMA as a WHERE a.po_status = ?1]]></ejb-ql>
</query>
<query>
<query-method>
<method-name>findByPo_no</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM NeworderSCHEMA as a WHERE a.po_no = ?1]]></ejb-ql>
</query>
<query>
<query-method>
<method-name>findByPo_noCMR</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM NeworderSCHEMA as a WHERE a.po_no = ?1]]></ejb-ql>
</query>
<!-- Write a file named ejb-finders-NeworderBean.xml if you want to define extra finders. -->
</entity>
<entity id="ContainerManagedEntity_OrderDetail">
<description><![CDATA[<!-- begin-xdoclet-definition -->]]></description>
<ejb-name>OrderDetail</ejb-name>
<home>order.detailentity.OrderDetailHome</home>
<remote>order.detailentity.OrderDetail</remote>
<local-home>order.detailentity.OrderDetailLocalHome</local-home>
<local>order.detailentity.OrderDetailLocal</local>
<ejb-class>order.detailentity.OrderDetailCMP</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>OrderDetailSCHEMA</abstract-schema-name>
<cmp-field id="CMPAttribute_9">
<description><![CDATA[<!-- begin-user-doc --> CMP Field serial_no Returns the serial_no]]></description>
<field-name>serial_no</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_10">
<description><![CDATA[<!-- begin-user-doc --> CMP Field po_no Returns the po_no]]></description>
<field-name>po_no</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_11">
<description><![CDATA[<!-- begin-user-doc --> CMP Field model_code Returns the model_code]]></description>
<field-name>model_code</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_12">
<description><![CDATA[<!-- begin-user-doc --> CMP Field color_code Returns the color_code]]></description>
<field-name>color_code</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_13">
<description><![CDATA[<!-- begin-user-doc --> CMP Field order_qty Returns the order_qty]]></description>
<field-name>order_qty</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_14">
<description><![CDATA[<!-- begin-user-doc --> CMP Field prod_yr Returns the prod_yr]]></description>
<field-name>prod_yr</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_15">
<description><![CDATA[<!-- begin-user-doc --> CMP Field prod_mth Returns the prod_mth]]></description>
<field-name>prod_mth</field-name>
</cmp-field>
<cmp-field id="CMPAttribute_16">
<description><![CDATA[<!-- begin-user-doc --> CMP Field recd_qty Returns the recd_qty]]></description>
<field-name>recd_qty</field-name>
</cmp-field>
<primkey-field>serial_no</primkey-field>
<query>
<query-method>
<method-name>findAll</method-name>
<method-params>
</method-params>
</query-method>
<ejb-ql><![CDATA[SELECT OBJECT(a) FROM OrderDetailSCHEMA as a]]></ejb-ql>
</query>
<!-- Write a file named ejb-finders-OrderDetailBean.xml if you want to define extra finders. -->
</entity>
<!--
To add entity beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called entity-beans.xml that contains
the <entity></entity> markup for those beans.
-->
<!-- Message Driven Beans -->
<!--
To add message driven beans that you have deployment descriptor info for, add
a file to your XDoclet merge directory called message-driven-beans.xml that contains
the <message-driven></message-driven> markup for those beans.
-->
</enterprise-beans>
<!-- Relationships -->
<relationships id="Relationships_1">
<ejb-relation id="EJBRelation_1">
<ejb-relation-name>Neworder</ejb-relation-name>
<ejb-relationship-role id="EJBRelationshipRole_1">
<ejb-relationship-role-name>Order-contains-Items</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source id="RoleSource_1">
<ejb-name>Neworder</ejb-name>
</relationship-role-source>
<cmr-field id="CMRField_1">
<cmr-field-name>items</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role id="EJBRelationshipRole_2">
<ejb-relationship-role-name>item-contained-in-order</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source id="RoleSource_2">
<ejb-name>OrderDetail</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
<ejb-relation id="EJBRelation_2">
<ejb-relation-name>Order-Items</ejb-relation-name>
<ejb-relationship-role id="EJBRelationshipRole_3">
<ejb-relationship-role-name>Order-has-Items</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source id="RoleSource_3">
<ejb-name>Neworder</ejb-name>
</relationship-role-source>
<cmr-field id="CMRField_2">
<cmr-field-name>itemValue</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role id="EJBRelationshipRole_4">
<multiplicity>Many</multiplicity>
<relationship-role-source id="RoleSource_4">
<ejb-name>
once again thank you -
Using CMR field as Primary Key in Entity Bean
Hi, all!
Can somebody tell me, is it possible to use CMR field as Primary Key field in Entity Bean?
ThanksWebLogic Server supports mapping a cmr field to the primary key.
-
Hi,
Up until now, most of my forms in jsf have had all the fields in the ejb. So when I did mergeEntity all the fields where updated with the correct data. Now I have a form that has just the ID of the ejb and one field. Now when I do mergeEntity all the other fields are set to null. Shouldn't mergeEntity just update the field I am setting? What do I need to do to update just one field in the ejb without bringing all the other fields in or is there an easy why to do that?
Thanks for you help. Any examples would be great!You're not supposed to put ## around it. That makes
Coldfusion look for a variable named "originated" inside a
structure named "affiliate", which obviously isn't what you want to
do.
In my query, I didn't have any hashes around field2.
Change your query to:
<CFQUERY datasource="#application.dsn#">
UPDATE affiliate
SET last_contacted = originated
</CFQUERY>
Maybe you are looking for
-
Can you get a refund of an in-app purchase when the app is faulty
I brought an in-app purchase to then find the app doesn't do what it's supposed to do and crashes all the time. I've tried contacting the develope/app owner and all I get is to contact iTunes. I'm not sure how to do this. Help please!
-
Hi From client machine 1. i going to command prompt 2. c:\> ftp serveripaddress (connecting for file transfer from client machine to server) 3. control move to server 4. then im using "BIN" 6. either get/put the file from/to client. Is it possiple to
-
Strange error when attempting to add an article to the Folio Builder
I've just installed the trial of InDesign 5.5 along with the Digital Publishing Suite. I've followed the instructions to add an article to the Folio Builder but I am continually greeted with this error: Not sure what I am doing wrong, the document is
-
Unavailable mapped network drive hangs file explorer
I am using Windows 8.1 Pro (x64) and I have this problem from beginning. I have mapped two network drives, one is my home NAS and second is shared network storage in our office. When I open some application which is loading directories (XnView for ex
-
Where can I freaking find an iPhone 4???
I am on a reserved waiting list at like 4-5 Apple stores here in Maryland. I have been for over a week and a half now, and im not getting any email notifications of my iPhone 4 being ready for pick up. 2 weeks ago I dropped my iPhone 3G in our pool,