Ejb 3.0 CMP updates
Hello,
Is there an easy way to update an entity bean that wasn't fetched via a find by PK query, i.e. it's just marshalled from a remote payload in EJB 3.0? merge() does not seem to work with out you using the marshalled PK to fetch it and then manually setting each field. I'm looking for some thing like a toplink mergeClone or the like. Any input would be appreciated. Take care.
The beans are deployed successfully, but when I find an object using the EntityManager, it is throwing
java.sql.SQLException: ORA-00904: "COLUMN_NAME": invalid identifier.
Is the EntityManager find method
find(java.lang.String entityName,
java.lang.Object primaryKey)?
@Id annotation is used for a single field primary key.
For a composite primary key use the @EmbeddedId annotation
and specify a primary key class with the @Embeddable annotation.
example:
@EmbeddedId
PKClass pkClass
@Embeddable
public PKClass {}
In the find method specify the @EmbeddedId instead of the @id.
find(entity, pkClass)
Similar Messages
-
Hi!
I have deal with EJB 2.0 CMP bean.
I have a composite PK so use the java class to store it. And there is a corresponding field in the Entity Bean with its primary key class type.
The problem is: when deployment tool creates sql query for the findByPrimaryKey(PKClass ck)
where ck is an object with 3 fielde : a_id, b_id, c_id.
it says:
<sql>SELECT "ck" FROM "MyTable" WHERE "ck" = ? </sql>
And it means by the "ck" simple a column in DB but NOT the composite key which has to be splited into 3 different fields. So the container can't do the proper mapping.
Does anyone know solutions?I was wrong about primary key class fields, take a look at Ejb2.0 Specification (10.8.2):
The primary key class must be public, and must have a public constructor with no parameters.
All fields in the primary key class must be declared as public.
The names of the fields in the primary key class must be a subset of the names of the container-managed
fields. (This allows the container to extract the primary key fields from an instance�s container-managed
fields, and vice versa.)
Right now I'm using BMP and I don't have this problems. Primary keys, calculated fields and types not supported by the DB can be easily achieved. But I understand your interest on CMP, is clearly evolving! -
Ejb-jar.xml中的EJB QL和weblogic-cmp-rdbms-jar.xml中的WLQL
我想问一下,在ejb-jar.xml文件中用EJB QL查询语言定义了相应的EJB QL查询语句后,在weblogic-cmp-rdbms-jar.xml文件中还需不需要用wlql语言来定义相应的查询语句呀?
在Weblogic6.0中,如果你需要利用EJB2.0的EJBQL语言所不提供的
ORDERBY排序功能,那么这时候可以在weblogic-cmp-rdbms-jar.xml中用WLQL覆盖它,一般情况下,在ejb-jar.xml中声明一个EJBQL方法就可以了,WLQL可有可无。 -
EJB Not Retrieving database updates
Hello,
I have named queries in EJBs built of tables. For example:
@Entity
@NamedQueries({
@NamedQuery(name = "DadUser.findAll", query = "select o from DadUser o"),
@NamedQuery(name = "DadUser.findOne", query = "select o from DadUser o " +
"where o.userId = :user_id")
@Table(name = "DAD_USER")
public class DadUser implements Serializable {
@Column(name="ACTIVE_FLAG")
private String activeFlag;
@Column(name="FULL_NAME")
private String fullName;
private String secure;
@Id
@Column(name="USER_ID", nullable = false)
private String userId;
public DadUser() {
getters and setters .....
return activeFlag;
My Session Facade:
@Stateless(name="dadFacade")
public class dadFacadeBean implements dadFacadeRemote, dadFacadeLocal {
@PersistenceContext(unitName="Model")
private EntityManager em;
public dadFacadeBean() {
public Object mergeEntity(Object entity) {
return em.merge(entity);
public Object persistEntity(Object entity) {
em.persist(entity);
return entity;
/** <code>select o from DadUser o where o.userId = :user_id</code> */
public DadUser queryDadUserFindOne(Object user_id) {
return (DadUser) em.createNamedQuery("DadUser.findOne").setParameter("user_id", user_id).getSingleResult();
}Backing bean:
@EJB
private dadFacadeLocal df;
public List<DadRequests> getUsers() {
return df.queryDadUserFindOne('test');
}If I make a change to a field on another form the changed data displays in the list. However, if I make a change directly in the Oracle database and commit the changed value, the data does not change in the JSF app unless I re-deploy it. I close the app and re-open and clear IE and the old value still displays. I have tried em.flush but nothing seems to refresh the list when Oracle is changed directly. Please HELP ! Thank you.
Edited by: GaryJSF on Jan 31, 2008 11:53 AMJust a shot:
I don't know if You typed it right but you try to call:
public DadUser queryDadUserFindOne(Object user_id) {
return (DadUser) em.createNamedQuery("DadUser.findOne").setParameter("user_id", user_id).getSingleResult();
}which returns DadUser, and then put it into List of DadRequests
public List<DadRequests> getUsers() {
return df.queryDadUserFindOne('test');
}I don't see how can it work ;), but You asked about EJB,
The reason why EJB returns old (not updated) values is that entity bean is held on app server and cached there, if you would have changed data in DB via EJB module it would also update cache in entity beans container.
So I think that it has nothing to do with JSF :]. -
Urget help needed- PK with EJB 1.1/CMP 1.1
I have some old code based on EJB 1.1 ,CMP 1.1 works on OC4J(9.0.02). Now going forward seems this does not work(seems it calls getprimarykey in ejbcreate in generated wrappers). Basically, I have a before insert trigger that generates nextval from oracle sequnece and we call create with
all required columns and set the PK to null. Will this setting work in CMP
for generating PK using oracle sequence. We are on OC4J so that is the hard part. Please share your experience. I am sure it will be valuable to many as this is a standard way in Oracle to use sequence.Hello,
Here are some of the interesting readings that you can have a look at
http://www.theserverside.com/patterns/thread.tss?thread_id=220
http://forum.java.sun.com/thread.jspa?threadID=248408&messageID=1812745
http://www-128.ibm.com/developerworks/websphere/library/techarticles/0402_brown/brown.html
With CMP you should avoid using auto generated primary keys. I tried this using Websphere and Oracle it does not work.
HTH
VJ -
OnetoOne Mapping Problem in EJB 3.0 CMP's
Hi,
Im new EJB3.0, and trying to implement onetoone mapping between two tables.
The beans are deployed successfully, but when I find an object using the EntityManager, it is throwing
java.sql.SQLException: ORA-00904: "COLUMN_NAME": invalid identifier.
When I am using the following tables and Classes,
The searching statement is as follows:
SELECT COMPANYID, COMPANYNAME, COMPANYADDR, ENAME, EMPNO FROM COMPANY WHERE ((COMPANYID = 'MUM') AND (COMPANYNAME = 'MUMBAI'))
But I want to retieve the Company Details, and Employee details individually,
Please help me to sort this out.
The script for tables is:
create table emp (empno VARCHAR2(4),ENAME VARCHAR2(10),SAL NUMBER(10,2),companyid varchar2(10) ,companyname varchar2(20),primary key(empno,ename,companyid,companyname));
create table company(companyid varchar2(10),companyname varchar2(20),companyaddr varchar2(20) not null,primary key(companyid,companyname));
ALTER TABLE EMP ADD CONSTRAINT PROJ_EMP_EMPLOYEE FOREIGN KEY (companyid,companyname) REFERENCES company(companyid,companyname);
desc company;
desc emp;
insert into company values('MUM','MUMBAI','MUMBAI BASTI');
insert into company values('CHE','CHENNAI','CHENNAI NAGAR');
insert into company values('HYD','HYDERABAD','HYDERABAD HITECH');
insert into emp values('12','GANGADHAR','2500','MUM','MUMBAI');
insert into emp values('16','SESHU','6500','CHE','CHENNAI');
insert into emp values('18','RUSTUM','8500','HYD','HYDERABAD');
COMMIT;
And the two Entitys and its primary keys are :
Company.java ( Entity Class , CMP)
package com.foursoft.hr;
import java.util.*;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Column;
import javax.persistence.Table;
import static javax.persistence.CascadeType.*;
import static javax.persistence.FetchType.*;
import static javax.persistence.EntityType.*;
@IdClass("com.foursoft.hr.CompanyPK")
@Entity()
@Table(name="COMPANY")
public class Company implements Serializable
public String companyid;
public String companyname;
public String companyaddr;
private Employee employee;
public Company(){}
@Id
@Column(name="COMPANYID",primaryKey=true)
public String getCompanyid(){ return companyid; }
public void setCompanyid(String compid){ companyid = compid; }
@Id
@Column(name="COMPANYNAME",primaryKey=true)
public String getCompanyname(){ return companyname; }
public void setCompanyname(String compname){ companyname = compname; }
public String getCompanyaddr(){ return companyaddr; }
public void setCompanyaddr(String compaddr){ companyaddr = compaddr; }
@OneToOne(targetEntity="com.foursoft.hr.Employee", cascade=ALL )
public Employee getEmployee()
return employee;
public void setEmployee(Employee employee)
this.employee = employee;
public String toString()
StringBuffer buf = new StringBuffer();
buf.append("Class:")
.append(this.getClass().getName())
.append(" :: ")
.append(" COMPANYID:")
.append(getCompanyid())
.append(" COMPANYNAME:")
.append(getCompanyname());
return buf.toString();
CompanyPK.java (Primary Key Class for Company Table)
package com.foursoft.hr;
public class CompanyPK implements java.io.Serializable
public java.lang.String companyid;
public java.lang.String companyname;
public boolean equals(Object obj){
CompanyPK pkObj = (CompanyPK)obj;
return (companyid.equals(pkObj.companyid) && companyname.equals(pkObj.companyname));
public int hashCode(){
try {
long crcKey = -1;
java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream(bos);
oos.writeObject(this);
oos.flush();
java.util.zip.Adler32 adl32 = new java.util.zip.Adler32();
adl32.update(bos.toByteArray());
crcKey = adl32.getValue();
return (int)(crcKey ^ (crcKey >> 32));
} catch (java.io.IOException ioEx) {
return -1;
Employee.java (Entity Class, CMP)
package com.foursoft.hr;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.IdClass;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import static javax.persistence.CascadeType.*;
import static javax.persistence.FetchType.*;
@IdClass("com.foursoft.hr.EmployeePK")
@Entity
@Table(name = "EMP")
public class Employee implements java.io.Serializable
private String empNo;
private String eName;
private double sal;
private Company company;
private String companyid;
private String companyname;
@Id
@Column(name="EMPNO",primaryKey=true)
public String getEmpNo() { return empNo; }
public void setEmpNo(String empNo) { this.empNo = empNo; }
@Id
@Column(name="ENAME" , primaryKey=true)
public String getEName() { return eName; }
public void setEName(String eName) { this.eName = eName; }
public double getSal() { return sal; }
public void setSal(double sal) { this.sal = sal; }
@OneToOne(fetch=LAZY,optional=false)
public Company getCompany() { return company; }
public void setCompany(Company company) { this.company=company; }
public String toString()
StringBuffer buf = new StringBuffer();
buf.append("Class:")
.append(this.getClass().getName())
.append(" :: ")
.append(" empNo:")
.append(getEmpNo())
.append(" ename:")
.append(getEName())
.append(" sal:")
.append(getSal());
return buf.toString();
EmployeePK.java (Primary Key Class for Employee Table)
package com.foursoft.hr;
public class EmployeePK implements java.io.Serializable
public java.lang.String empNo;
public java.lang.String eName;
public boolean equals(Object obj){
EmployeePK pkObj = (EmployeePK)obj;
return (empNo.equals(pkObj.empNo)&& eName.equals(pkObj.eName));
public int hashCode(){
try {
long crcKey = -1;
java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream(bos);
oos.writeObject(this);
oos.flush();
java.util.zip.Adler32 adl32 = new java.util.zip.Adler32();
adl32.update(bos.toByteArray());
crcKey = adl32.getValue();
return (int)(crcKey ^ (crcKey >> 32));
} catch (java.io.IOException ioEx) {
return -1;
Thanks very much!
Gangadhar.The beans are deployed successfully, but when I find an object using the EntityManager, it is throwing
java.sql.SQLException: ORA-00904: "COLUMN_NAME": invalid identifier.
Is the EntityManager find method
find(java.lang.String entityName,
java.lang.Object primaryKey)?
@Id annotation is used for a single field primary key.
For a composite primary key use the @EmbeddedId annotation
and specify a primary key class with the @Embeddable annotation.
example:
@EmbeddedId
PKClass pkClass
@Embeddable
public PKClass {}
In the find method specify the @EmbeddedId instead of the @id.
find(entity, pkClass) -
Unable to deploy ejb jar consisting CMP and Stateful in single ejb-jar.xml
Hi
I was able to deploy entity bean and stateless bean saperately but when i am trying to deploy a jar consisting of CMP entity and Stateless within single ejb-jar.xml it shows following errors.
Auto-deploying ejb_SDCurrency.jar (No previous deployment found)... ISDCMCurrencyHome_EntityHomeWrapper4.java:830: 'finally'
wi
finally
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:835: 'try' without 'catch' or 'finally'.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:838: 'catch' without 'try'.
catch(java.sql.SQLException e)
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:889: '}' expected.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:893: 'try' without 'catch' or 'finally'.
public com.satyam.icalm.staticdata.currency.ISDCMCurrency findByCode(int argument0, java.lang.String argument1) throws
javax.ej
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:893: Statement expected.
public com.satyam.icalm.staticdata.currency.ISDCMCurrency findByCode(int argument0, java.lang.String argument1) throws
javax.ej
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:961: 'finally' without 'try'.
finally
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:966: 'try' without 'catch' or 'finally'.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:968: 'catch' without 'try'.
catch(java.sql.SQLException e)
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1017: '}' expected.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1021: 'try' without 'catch' or 'finally'.
public com.satyam.icalm.staticdata.currency.ISDCMCurrency findAllByCode(int argument0, java.lang.String argument1) throws
javax
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1021: Statement expected.
public com.satyam.icalm.staticdata.currency.ISDCMCurrency findAllByCode(int argument0, java.lang.String argument1) throws
javax
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1371: 'finally' without 'try'.
finally
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1376: 'try' without 'catch' or 'finally'.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1378: 'catch' without 'try'.
catch(java.sql.SQLException e)
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1427: '}' expected.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1431: 'try' without 'catch' or 'finally'.
public java.util.Enumeration findAuthorizedRecords(int argument0) throws javax.ejb.FinderException, java.rmi.RemoteException
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1431: Statement expected.
public java.util.Enumeration findAuthorizedRecords(int argument0) throws javax.ejb.FinderException, java.rmi.RemoteException
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1496: 'finally' without 'try'.
finally
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1501: 'try' without 'catch' or 'finally'.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1504: 'catch' without 'try'.
catch(java.sql.SQLException e)
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1555: '}' expected.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1559: 'try' without 'catch' or 'finally'.
public java.util.Enumeration findAllRecords(int argument0) throws javax.ejb.FinderException, java.rmi.RemoteException
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1559: Statement expected.
public java.util.Enumeration findAllRecords(int argument0) throws javax.ejb.FinderException, java.rmi.RemoteException
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1624: 'finally' without 'try'.
finally
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1629: 'try' without 'catch' or 'finally'.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1632: 'catch' without 'try'.
catch(java.sql.SQLException e)
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1683: '}' expected.
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1685: 'try' without 'catch' or 'finally'.
public ISDCMCurrencyHome_EntityHomeWrapper4() throws java.rmi.RemoteException
^
ISDCMCurrencyHome_EntityHomeWrapper4.java:1685: Statement expected.
public ISDCMCurrencyHome_EntityHomeWrapper4() throws java.rmi.RemoteException
^
30 errors
Error compiling C:\oc4jext\j2ee\home\applications\calm6/ejb_SDCurrency.jar: Syntax error in source
com.evermind.compiler.CompilationException: Syntax error in source
at com.evermind.compiler.FileLinkedCompilation.run(FileLinkedCompilation.java:90)
at java.security.AccessController.doPrivileged(Native Method)
at com.evermind.compiler.FileLinkedCompiler.compile(FileLinkedCompiler.java:19)
at com.evermind.compiler.Javac.compile(Javac.java:37)
at com.evermind.server.ejb.compilation.Compilation.compileClasses(Compilation.java:335)
at com.evermind.server.ejb.compilation.Compilation.compile(Compilation.java:256)
at com.evermind.server.administration.ServerApplicationInstallation.finish(ServerApplication
Installation.java:439)
at java.lang.reflect.Method.invoke(Native Method)
at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:80)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62)
Note:The same jar is deployed into Weblogic 5.1 and was working fine .....
so please if any solutions .....
regards,
SapHi sapthapathi,
From the information u have provided, i can only guess, that
the problem is in ur code...Not in ejb-jar.xml....
'coz there is no problem in combining stateless session bean and CMP entity bean information in a single ejb-jar.xml file...i myself have deployed bunch of CMPs with stateless session beans..
So please check ur code once again....
--Venky -
Hi,
Is there a way to update multiple rows when using CMPs.
For example I can update multiple rows by this method.
while (condition)
cmp = cmpHome.findByPrimaryKey(key);
cmp.setValue(newValue);
Rather than this method is there a way that I can update many rows just as normal sql update.
thanks in advance,
chamal.If you want to concatenate Acol column with sysdate for 605 and 608 ....i think you need to code less (of what you have posted)
UPDATE TEST
SET TEST.ACOL = TEST.ACOL || ' ' ||sysdate
where
test.acol in (605,608);--I don't know why you want this , Just given the suggestion as per the requirement. -
EJB 3.0: CMP Entity bean from view
Hi,
I have created an entity bean from a database view.
I don't have a good filed to use as id in my view. So I want to generate the id in my entity bean.
How can I do this ?
ThanksHi,
I didn't get your question.
CMP is something, which can be done by hand.
So maybe it is better, to do it manually.
Bea has some workaround, I am sure.
Maybe it is something with deployment descriptors, which
have to be configured to the underlying database.
Sorry for my stupid first answer.
Volker. -
EJB 2.0 cmp entity beans problem with 8.17
I have a little application as client JBuilder,Weblogic 7.0 on the middleware
and 8.17 personnal at the backend,with Cloudscape java database,it worked fine.
I have two tables in it,with a one-to-many relationship,the ClientID from the Clients Table is foreign key in the other.
But now with 8.17 I have a RollbackException(cannot create Factures instance with the foreign key field null)so I cannot create any instance at the many side from the relation because the ClientID which is with EJB2.0 not a cmp field,is put automatically by the container in the table,
but this process seems not to work with 8.17,
what can I do?
Have someone a solution?Hi,
I didn't get your question.
CMP is something, which can be done by hand.
So maybe it is better, to do it manually.
Bea has some workaround, I am sure.
Maybe it is something with deployment descriptors, which
have to be configured to the underlying database.
Sorry for my stupid first answer.
Volker. -
Ejb relationships using cmp field
I have defined a cmp relationship using cmr field. Als defined getter/setter for that field.
When I call the getter method container returns all the records for relation.
getter/setter is implemented by container.
My question is can we define in which order relationships record should be retrieved. I mean can we specify Order By caluse for that.if you want to do this you just have to use Map on collection side of your relationship like this:
@OneToMany(cascade={CascadeType.ALL})
@JoinColumn(name="CUSTOMER_ID")
@MapKey(name="number")
@OrderBy
("number ASC")
public Map<String, Phone> getPhoneNumbers -
CMP EJB CLOB/BLOB retrieval issues from Oracle through JBoss
I have some EJB 2.0 CMP Entity Beans, deployed on a JBoss 3.07 application server.
In some of my beans I have Strings that I would like to map to a CLOB in my database as the Strings could easily be more than 4000 characters, and some byte arrays that I would like to map to a BLOB in my database to store files.
When I use PostgreSQL as my datastore in JBoss I can store and retrieve data from my CLOBs and BLOBs just fine.
However when I use an Oracle 9i (9.0.1) database for my datastore, I can write the information to the CLOB/BLOB fields (I can see it when I manually check the tables), but for some reason I cannot retrieve the information when I load my beans. The fields that map to the CLOB/BLOB are null, and eventually resave themselves overwriting the data in the database.
When I test using LONG RAW as a type it works perfectly, but LONG RAW is not a standard SQL type. I do not want to convert my beans to BMP, and also do not want to have any Oracle specific code in my beans to store retrieve my information. I need my beans to be completely database independant.
Does anyone have any ideas what could be causing my retrieval problem and what I could do to fix it?I solved my problem.
I am using XDoclet to generate my bean interfaces and xml files etc., and it generates the jbosscmp-jdbc.xml file for me.
I forgot to add @jboss tags to my beans so that the jbosscmp-jdbc.xml file includes tags to overwrite the default cmp mapping (string to varchar) to be from string to clob for those specific long string fields that i want. -
Hey folks,
I'm wondering how ejb security properties are updated at runtime.
I've defined security-roles and principals in the weblogic-ejb-jar
descriptor and assigned roles in the ejb-jar descriptor. This much
is working fine. Using the console I can add the principals to
the default Realm but I can't add new role/groups to the ejb method
acl. Is this do able? If so can it be done with the console.
Thanks,
all help is greatly appreciated
GeordieGeordie,
Today, this is done by modifying the deployment descriptor and
redeploying the bean. I think there are plans to make this better in a
future release.
Geordie wrote:
Hey folks,
I'm wondering how ejb security properties are updated at runtime.
I've defined security-roles and principals in the weblogic-ejb-jar
descriptor and assigned roles in the ejb-jar descriptor. This much
is working fine. Using the console I can add the principals to
the default Realm but I can't add new role/groups to the ejb method
acl. Is this do able? If so can it be done with the console.
Thanks,
all help is greatly appreciated
Geordie--
Tom Mitchell
[email protected]
Very Current Stoneham, MA Weather
http://www.tom.org -
Error While Deploying A CMP Entity Bean With A Composite Primary Key
Hello all,
I have a problem deploying CMP Entity beans with composite primary keys. I have a CMP Entity Bean, which contains a composite primary key composed of two local stubs. If you know more about this please respond to my post on the EJB forum (subject: CMP Bean Local Stub as a Field of a Primary Key Class).
In the mean time, can you please tell me what following error message means and how to resolve it? From what I understand it might be a problem with Sun ONE AS 7, but I would like to make sure it's not me doing something wrong.
[05/Jan/2005:12:49:03] WARNING ( 1896): Validation error in bean CustomerSubscription: The type of non-static field customer of the key class
test.subscription.CustomerSubscriptionCMP_1530383317_JDOState$Oid must be primitive or must implement java.io.Serializable.
Update the type of the key class field.
Warning: All primary key columns in primary table CustomerSubscription of the bean corresponding to the generated class test.subscription.CustomerSubscriptionCMP_1530383317_JDOState must be mapped to key fields.
Map the following primary key columns to key fields: CustomerSubscription.CustomerEmail,CustomerSubscription.SubscriptionType. If you already have fields mapped to these columns, verify that they are key fields.Is it enough that a primary key class be serializable or all fields have to implement Serializable or be a primitive?
Please let me know if you need more information to answer my question.
Thanks.
NikolaHi Nikola,
There are several problems with your CMP bean.
1. Fields of a Primary Key Class must be a subset of CMP fields, so yes, they must be either a primitive or a Serializable type.
2. Sun Application Server does not support Primary Key fields of an arbitrary Serializable type (i.e. those that will be stored
as BLOB in the database), but only primitives, Java wrappers, String, and Date/Time types.
Do you try to use stubs instead of relationships or for some other reason?
If it's the former - look at the CMR fields.
If it's the latter, I suggest to store these fields as regular CMP fields and use some other value as the PK. If you prefer that
the CMP container generates the PK values, use the Unknown
PrimaryKey feature.
Regards,
-marina -
Interop Survey: Which EJB Container is _known_ to work with which RDBMS?
Which EJB Container
have you personally used to successfully deploy entity beans
in combination with which RDBMS Server Product[s]
in a production environment supporting more than just a few users?
EJB Container
.VendorName =
.ProductName =
.ProductVersion =
.ProductLanguage =
.EJB-Spec-Version =
RDBMS Server 1
.VendorName =
.ProductName =
.ProductVersion =
.ProductLanguage =
Did you do multi database update ACID transactions that were managed by the EJB Container (ie CMP not BMP)?
YES
NO
If so, did you do them across more than one RDBMS Server Product, such as mixing DB2 with SQL Server?
YES
NO
RDBMS Server Product 2
.VendorName =
.ProductName =
.ProductVersion =
.ProductLanguage =
I intend to publish the results to this forum by 15 Aug 2005.
Please post any responses until 31 July 2005 so I can consider them in the survey.Tomcat does not support EJB deployment as it is a mere servlet engine. But it can be integrated with with JBoss, an app server which is freely available.
-amit
Maybe you are looking for
-
I was using Firefox to read my Netzero email. The print suddenly dropped down to very small and I have difficulty reading the email. Netzero said to oper Mozilla Firefox, click "tools", click "options", and click "content" to change the font to a big
-
Joining two tables on different datatype key
Hi, I have two two tables, create table table1( primkey1 double, name varchar(30)) create table table2( primkey2 double, name varchar(30)) Now I have to join these two table in RPD. I tried to join but i got an error. plz tell me the way to join thes
-
2 MDBs inserting same row in table
Hi all, I have a unique requirement. Environment: Application is in cluster. I have kept 1 MDB instance on each server. Each MDB listening to same external JMS queue. A database table row is inserted and one existing is updated by MDBs whenever they
-
List of SAP HR implemented Product based companies in India / Dubai
Hi Guys, Please some one send me the list of all product based companies who all are implemented SAP HR module in India / Dubai. Thanks in advance. Regards, Ganesh M,
-
How to add some html text between check boxes choices in SharePoint list?
I'm customizing "New Form" of a share point list using SharePoint Designer. One of column is check boxes, and I need to add some break lines and text between choices, so the choice doesn't become cluttered. e.g. Choice 1 ^n Date Location Choice 2 ^n