WLS8.1sp4 running into Bean with primary key
We're facing an interesting issue with WLS8.1sp4.
We have upgraded from WLS6.1sp5 to WLS8.1sp4, while testing running into the following error.
javax.ejb.NoSuchObjectLocalException: [EJB:010140]Bean with primary key: '5375758' not found.: javax.ejb.NoSuchEntityException: [EJB:010140]Bean with primary key: '5375758' not found.
at weblogic.ejb20.manager.BaseEntityManager.checkForReentrant(BaseEntityManager.java:1460)
at weblogic.ejb20.manager.DBManager.preInvoke(DBManager.java:251)
at weblogic.ejb20.internal.BaseEJBLocalObject.preInvoke(BaseEJBLocalObject.java:228)
at weblogic.ejb20.internal.EntityEJBLocalObject.preInvoke(EntityEJBLocalObject.java:72)
at edu.harvard.gmas.budget.SegmentLineItemBean_uyzy57_ELOImpl.getSubagreement(SegmentLineItemBean_uyzy57_ELOImpl.java:138)
at edu.harvard.gmas.budget.SegmentCategoryManager.entityToSegmentLineItemData(SegmentCategoryManager.java:1610)
at edu.harvard.gmas.budget.SegmentCategoryManager.entityToSegmentCategoryData(SegmentCategoryManager.java:1494)
at edu.harvard.gmas.budget.SegmentCategoryManager.fetchSegmentCategoryData(SegmentCategoryManager.java:2833)
at edu.harvard.gmas.budget.CategoryBudgetManager.fetchCategoryBudgetDataForProposedBudget(CategoryBudgetManager.java:2882)
at edu.harvard.gmas.budget.BudgetMediatorBean.recalculateAndUpdateCategoryAmountsForProposedBudget(BudgetMediatorBean.java:6855)?:|?:|
The code is already there with JDBC call inserting
into the table, the inserting trigger then will generate
sequence key and being inserted into primary key column.
Now wondering if it's possible to change the code to use entity bean but without modifying the trigger (since it contains other business logics).
Similar Messages
-
Javax.ejb.ObjectNotFoundException: Bean with primary key '555' was not foun
When I delete a particular entity bean instance, i get the following exception:
javax.ejb.ObjectNotFoundException: Bean with primary key '555' was not found by 'findByPrimaryKey'.
But, the instance is being deleted from the database.
Anyone please help,
Thank u,
SeshuGreetings,
When I delete a particular entity bean instance, i get
the following exception:
javax.ejb.ObjectNotFoundException: Bean with primary
key '555' was not found by 'findByPrimaryKey'.Interesting. How is your client calling the bean's remove method? Directly or through its home? Is it calling findByPrimaryKey before or after the call to remove? What is the PrimaryKey class type of your bean? Is the client passing a correct instance? All are things to be considered when troubleshooting your application. If more assistance is required, then seeing the relevant source code would be more helpful.
But, the instance is being deleted from the database.As is generally to be expected. No?
Anyone please help,
Thank u,
SeshuRegards,
Tony "Vee Schade" Cook -
Entity Bean with Primary Key Class
Hi
I am trying to develop an entity bean attached to a key which have a
composite key using Primary Key Class. When I use the findByPrimaryKey
method of the bean it throws an exception as follows,
java.sql.SQLException: Parameter typecheck failed: invalid parameter type:
ORA-00000: normal, successful completion
at com.netscape.server.jdbc.PreparedStatement.verifyError(Unknown Source)
at com.netscape.server.jdbc.PreparedStatement.afterVerify(Unknown Source)
at com.netscape.server.jdbc.PreparedStatement.executeQuery(Unknown Source)
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
at
com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
Source)
at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
at
TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
ean2_EntityBean2Bean.java:120)
at
TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
at
TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
ean2Home.java:341)
at
TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
..java:88)
at TestBean2.Simple1.defaultAction(Simple1.java:115)
at TestBean2.Simple1.doGet(Simple1.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Thread.run(Thread.java:479)
javax.ejb.FinderException
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)
at
com.netscape.server.ejb.EntityDelegateManagerImpl.doPersistentFind(Unknown
Source)
at com.netscape.server.ejb.EntityDelegateManagerImpl.find(Unknown Source)
at com.kivasoft.eb.EBHomeBase.findSingleByParms(Unknown Source)
at
TestBean2.ejb_home_TestBean2_EntityBean2Bean.findByPrimaryKey(ejb_home_TestB
ean2_EntityBean2Bean.java:120)
at
TestBean2.ejb_kcp_skel_EntityBean2Home.findByPrimaryKey__TestBean2_EntityBea
n2__TestBean2_TestBKey(ejb_kcp_skel_EntityBean2Home.java:258)
at com.kivasoft.ebfp.FPRequest.invokenative(Native Method)
at com.kivasoft.ebfp.FPRequest.invoke(Unknown Source)
at
TestBean2.ejb_kcp_stub_EntityBean2Home.findByPrimaryKey(ejb_kcp_stub_EntityB
ean2Home.java:341)
at
TestBean2.ejb_stub_EntityBean2Home.findByPrimaryKey(ejb_stub_EntityBean2Home
..java:88)
at TestBean2.Simple1.defaultAction(Simple1.java:115)
at TestBean2.Simple1.doGet(Simple1.java:26)
[03/Aug/2001 15:26:41:7] error: Exception: SERVLET-execution_failed: Error
in executing servlet Simat
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServletple1: java.lang.ClassCastException:
com.netscape.server.deployment.EntityBeanDescriptor
Exception .service(HttpServlet.java:865)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
Source)Stack Trace:
java.lang.ClassCastException:
com.netscape.server.deployment.EntityBeanDescriptor
a
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.applogic.AppLogic.ext
com.netscape.server.servlet.servletrunner.AppInfo.popWebAppDescriptor(Unknow
n Source)
at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source)
at com.netscape.server.seecute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Threadrvlet.servletrunner.ServletRunner.execute(Unknown
Source)
at com.kivasoft.applogic.AppLogic.execu.run(Thread.java:479)
te(Unknown Source)
at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
at com.kivasoft.thread.ThreadBasic.run(Native Method)
at java.lang.Thread.run(Thread.java:479)
Any kind of help is appreciated. I am using iPlanet App Builder 6.0 with iAS
6.0 SP1.
Thanks
Bhaskara Murthy
Eclipse Networks Inc"Bhamu" <[email protected]> wrote in message
news:9keuo4$[email protected]..
I am trying to develop an entity bean attached to a key which have a
composite key using Primary Key Class. When I use the findByPrimaryKey
method of the bean it throws an exception as follows,I notice that you are using the reference CMP plugin.
at com.netscape.server.ejb.SQLPersistenceManager.find(Unknown Source)I'm also willing to bet that you may have created your own primary key class
with a single field, rather than using the fields type as a primitive
primary key class. If you do this, then SQLPersistenceManager will break.
It is badly written, and has some stupid assumptions. The one I remember
the most is that if you only have one primary key field, then
SQLPersistenceManager assumes you have used a primitive type such as
java.lang.String or java.lang.Integer, to represent it, rather than creating
your own <Enity>Pk.java file.
SQLPersistenceManager works for toy examples, but in general I would say it
is broken and unusable. Either use BMP, or splash out the money for Coco
Base from Thought Inc. Currently the only CMP plugin for iPlanet App server,
other than the reference implementation, that I know of. -
Entity bean with primary key generated by trigger
Hi,
We have a table(oracle) with one column as primary key,
but the primary key is generated by trigger every time
a new row is inserted into this table, inside the trigger,
it uses oracle sequence to get the next val.
If we want to use entity bean with it, what should we specify, it's not application-managed primay key, it's
not auto-generated primary key either. How can we resolve
it without change the database part.
Any thought is appreciated.
Thanks
afangThe code is already there with JDBC call inserting
into the table, the inserting trigger then will generate
sequence key and being inserted into primary key column.
Now wondering if it's possible to change the code to use entity bean but without modifying the trigger (since it contains other business logics). -
Deploying BMP Entity Bean with primary key calss
Hi,
I am using EJB 2.0 with and websphere studio 5.0 and database is sql server 2000.
My BMP Entity bean has a primary key class.From my client I am invoking the Entity Bean by calling it's findbyprimarykey method.
The home interface of my findbyprimarykey method returns a class of type Remote.But in the Entity Bean class,the return type is the primarykey class type.
My problem is invoking this findbyprimarykey from the client to get the remote interface so that the other business methods of the entity bean can be called.
The control goes into the ejbFindbyPrimaryKey but when it is returing from the Entity Bean class,it gives a remote exception (as the return type in Entity Bean class and Home interface are different for the findbyprimarykey method).
I think that somewhere in the deployment decriptor in my websphere,i have to specify the primarykey class type,which i am missing out and hence getting the error.
Please help me out with your advice and solution.
Thanks
Rahul PriyadarshiHi,
Sorry to disturb you again.
Even my code is also almost the same....i am pasting the code below...Please go through it and let me know if I have made any mistake..
EditVendorEntityBean.....(Bean Class)
package code.beans.EditVendor;
import code.beans.dataAccess.*;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.ejb.EntityBean;
import javax.ejb.EntityContext;
import javax.ejb.EJBException;
import javax.ejb.FinderException;
import javax.ejb.ObjectNotFoundException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.sql.*;
import javax.sql.*;
import java.util.*;
* Bean implementation class for Enterprise Bean: EditVendorEntity
public class EditVendorEntityBean implements javax.ejb.EntityBean {
private static Hashtable dataSources = new Hashtable();
private String username;
private int Vendor_ID;
private int Category_Id;
private String Category_Name;
private String Vendor_Name;
private String Vendor_Address1;
private String Vendor_Address2;
private String Contact_Name;
private String Home_Phone;
private String Work_Phone;
private String email;
private String faxno;
private String userloginname;
private boolean dirtyFlag = false;
private EntityContext context;
private static final String DS_NAME = "jdbc/spiPOPS";
Connection con = null;
Statement stmt = null;
PreparedStatement st = null;
ResultSet res = null;
//***********************Business Methods*********************
// Begin of Busines Methods
public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax) {
System.out.println("in setData where Vendor Id= "+ Vendor_ID);
boolean status=false;
boolean existing=false;
ArrayList cat=new ArrayList();
try
cat=getcategorylist(this.Vendor_ID);
catch(SQLException e)
System.out.println("Could not get category list");
System.out.println("Size of cat array -->" + cat.size() + " and string array size -->" + catname.length);
if(catname.length>0)
//Removing unwanted vendor categories for a particular vendor id
for(int i=0;i<cat.size();i++)
existing=false;
String tempdata=(String)cat.get(i);
for(int j=0;j<catname.length;j++)
if(tempdata.equals(catname[j]))
existing=true;
if(!existing)
try
delvencat(this.Vendor_ID,tempdata.trim());
catch(SQLException e)
System.out.println("Could not delete record in POPS_VENDOR_CATEGORY for -->" + tempdata);
//Adding new vendor categories for a particular vendor
try
for(int i=0;i<catname.length;i++)
status=false;
String strcat=catname;
status=checkcat(this.Vendor_ID,strcat.trim());
if(!status)
insertvencat(this.Vendor_ID,strcat.trim());
catch(SQLException e)
System.out.println("Could not insert or select from POPS_VENDOR_CATEGORY table");
this.Vendor_Name =vendorname;
this.Vendor_Address1 =vendadd1;
this.Vendor_Address2 =vendadd2;
this.Contact_Name =vendcontact;
this.Work_Phone =venoff;
this.Home_Phone =venres;
this.email =mailid;
this.faxno =venfax;
dirtyFlag = true;
System.out.println("Leaving set data method");
public Vector getData() {
Vector vctRec=new Vector();
ArrayList arrdatas = new ArrayList();
arrdatas.add(""+this.Vendor_ID);
arrdatas.add(this.Vendor_Name);
arrdatas.add(this.Vendor_Address1);
arrdatas.add(this.Vendor_Address2);
arrdatas.add(this.Contact_Name);
arrdatas.add(this.Work_Phone);
arrdatas.add(this.Home_Phone);
arrdatas.add(this.email);
arrdatas.add(this.faxno);
vctRec.addElement(arrdatas);
ArrayList cat=new ArrayList();
try
System.out.println("Calling getcategorylist from getdata with vendorid-->" + this.Vendor_ID);
cat = getcategorylist(this.Vendor_ID);
catch(SQLException e)
System.out.println("Could not get datas for category list");
vctRec.addElement(cat);
ArrayList allcats=new ArrayList();
try
allcats = getallcategorylist();
catch(SQLException e)
System.out.println("Could not get datas for category list");
vctRec.addElement(allcats);
dirtyFlag = false;
System.out.println("Before return statement in getdata with vector size -->" + vctRec.size());
return vctRec;
// End of Business Methods
//**************************Entity Bean Methods*******************************
* ejbActivate
public void ejbActivate() {
Vendor_ID = Integer.parseInt((String)context.getPrimaryKey());
System.out.println("Inside ejbActivate Vendor_ID-->"+ Vendor_ID);
* ejbLoad
public void ejbLoad() {
System.out.println("Inside ejbLoad ********" );
try {
loadRow();
}catch (Exception ex) {
System.out.println("Failed in loadRow()");
throw new EJBException("ejbLoad: " +
ex.getMessage());
* ejbPassivate
public void ejbPassivate() {
System.out.println("Inside ejbPassivate " );
Vendor_ID = 0;
* ejbRemove
public void ejbRemove() throws javax.ejb.RemoveException {
//Empty Method
* ejbStore
public void ejbStore() {
System.out.println("Inside ejbStore " );
try {
storeRow();
}catch (Exception ex) {
System.out.println("Exception thrown in storeRow" + ex.getMessage());
throw new EJBException("ejbLoad: " +
ex.getMessage());
* getEntityContext
public javax.ejb.EntityContext getEntityContext() {
return context;
* setEntityContext
public void setEntityContext(javax.ejb.EntityContext ctx) {
System.out.println("Inside setEntityContext " );
try{
con = getConnection(DS_NAME);
System.out.println("DB Connection Created!!");
catch(Exception e){
this.context = ctx;
* unsetEntityContext
public void unsetEntityContext() {
System.out.println("Inside unsetEntityContext " );
closeDbConnection(con, res, st);
this.context = null;
* ejbCreate
//code.beans.EditVendor.EditVendorEntityKey
public code.beans.EditVendor.EditVendorEntityKey ejbCreate(String vendorid)
throws javax.ejb.CreateException {
return new EditVendorEntityKey(vendorid);
//return null;
* ejbPostCreate
public void ejbPostCreate(String vendorid) throws javax.ejb.CreateException {
//Empty
* ejbFindByPrimaryKey
//code.beans.EditVendor.EditVendorEntityKey
public code.beans.EditVendor.EditVendorEntityKey ejbFindByPrimaryKey(
code.beans.EditVendor.EditVendorEntityKey primaryKey)
throws javax.ejb.FinderException {
try {
if(selectByPrimaryKey(Integer.parseInt(primaryKey.getVendorId()))) {
System.out.println("Leaving the findbyprimarykey method from the entity bean");
return primaryKey;
//return null;
}else {
throw new ObjectNotFoundException
("Row for id " + primaryKey + " not found.");
}catch (Exception ex) {
throw new EJBException("EXCEPTION IN ejbFindByPrimaryKey :- " + ex.getMessage());
/*********************** Database Utility Routines *************************/
private boolean selectByPrimaryKey(int priKey)
throws SQLException {
System.out.println("inside selectByPrimaryKey for primary key " + priKey);
String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR WHERE VENDOR_ID = " + priKey;
System.out.println("in selectByPrimaryKey where queryString is: "+ queryStr);
stmt = con.createStatement();
ResultSet result = stmt.executeQuery(queryStr);
if(!result.next()) {
stmt.close();
System.out.println("Did not find "+priKey);
return false;
else { //Found the primaryKey
Vendor_ID = result.getInt("VENDOR_ID");
stmt.close();
return true;
private void loadRow() throws SQLException {
System.out.println("inside loadRow ...");
stmt = con.createStatement();
String queryStr = "SELECT VENDOR_NAME,VENDOR_ADDRESS1,VENDOR_ADDRESS2,CONTACT_NAME,HOME_PHONE,WORK_PHONE,EMAIL_ID,FAX_NO " +
"FROM POPS_VENDOR WHERE VENDOR_ID=" + Vendor_ID;
System.out.println("Inside loadRow()***********"+queryStr);
ResultSet result = stmt.executeQuery(queryStr);
ArrayList catadatas=new ArrayList();
if(!result.next())
throw new SQLException("No record for primary key" + Vendor_ID);
this.Vendor_ID =Vendor_ID;
this.Vendor_Name =result.getString("VENDOR_NAME");
this.Vendor_Address1 =result.getString("VENDOR_ADDRESS1");
this.Vendor_Address2 =result.getString("VENDOR_ADDRESS2");
this.Contact_Name =result.getString("CONTACT_NAME");
this.Home_Phone =result.getString("HOME_PHONE");
this.Work_Phone =result.getString("WORK_PHONE");
this.email =result.getString("EMAIL_ID");
this.faxno =result.getString("FAX_NO");
System.out.println("Leaving loadrow method with loaded datas for vendor -->" + Vendor_ID);
stmt.close();
private ArrayList getcategorylist(int vendor) throws SQLException{
String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID=" + vendor;
System.out.println("Query for the cat list --> " + queryStr);
stmt = con.createStatement();
ResultSet result = stmt.executeQuery(queryStr);
ArrayList catdatas=new ArrayList();
try{
while(result.next())
catdatas.add(result.getString("VENDOR_CAT"));
catch (SQLException e){
stmt.close();
System.out.println("Could not retrieve datas for Category list");
stmt.close();
System.out.println("size off array for cat -->" + catdatas.size() + " and datas ->" + catdatas);
return catdatas;
private ArrayList getallcategorylist() throws SQLException{
//String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY";
StringBuffer strquery=new StringBuffer(20);
strquery.append("SELECT DISTINCT(CATEGORY_NAME) FROM POPS_CATEGORY");
stmt = con.createStatement();
//ResultSet result = stmt.executeQuery(queryStr);
ResultSet result = stmt.executeQuery(strquery.toString());
ArrayList catdatas=new ArrayList();
try{
while(result.next())
//catdatas.add(result.getString("VENDOR_CAT"));
catdatas.add(result.getString("CATEGORY_NAME"));
catch (SQLException e){
stmt.close();
System.out.println("Could not retrieve datas for All Category list");
stmt.close();
return catdatas;
private void delvencat(int vendor,String vencat) throws SQLException {
int update=-1;
stmt = con.createStatement();
String queryStr ="DELETE FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + vencat.toUpperCase() + "'";
System.out.println("Delete query --> " + queryStr);
update= stmt.executeUpdate(queryStr);
if(update!=1)
System.out.println("Did not find data to delete");
stmt.close();
private void insertvencat(int vendor,String vencat) throws SQLException {
int update=-1;
String queryStr ="INSERT INTO POPS_VENDOR_CATEGORY(VENDOR_ID,VENDOR_CAT)" +
" VALUES(" + vendor +",'" + vencat + "')";
System.out.println("Insert query --> " + queryStr);
stmt = con.createStatement();
update=stmt.executeUpdate(queryStr);
if(update!=1)
System.out.println("Could not insert records in the database");
stmt.close();
private boolean checkcat(int vendor,String catven) throws SQLException {
boolean datastatus=false;
String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + catven.toUpperCase() + "'";
stmt = con.createStatement();
ResultSet result = stmt.executeQuery(queryStr);
datastatus=result.next();
stmt.close();
return datastatus;
private void storeRow() throws SQLException {
System.out.println("Inside ejb store");
if (!dirtyFlag) {
System.out.println("Skipping the UPDATE because object is not dirty");
return;
CallableStatement cs=null;
try{
cs = con.prepareCall("EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
System.out.println("\n\n SQL Statement : \n " + "EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
cs.executeUpdate();
catch (SQLException e){
cs.close();
System.out. println("\n\n Error in calling stored procedure POPS_INSERT_NEW_REQUEST \n\n"+ e.getMessage() + "\n\n");
cs.close();
dirtyFlag = false;
private Connection getConnection(String dbName) throws SQLException
String configuredDataSourceName = null;
if (dbName == null) {
System.out.println("Attemp to get connection failed. The requested database name is null");
DataSource dbSource = getDataSource(dbName);
return dbSource.getConnection();
private DataSource getDataSource(String dbName)
// looking from cache;
DataSource dbSource = (DataSource) dataSources.get(dbName);
if (dbSource == null) { //we need to find it from JNDI
try {
Context ic = new InitialContext();
dbSource = (DataSource) ic.lookup(dbName);
dataSources.put(dbName, dbSource);
}catch (NamingException e){
return dbSource;
* User calls this function to safely close an connection
* @param connt The connection a datasource
* @param rs The resulSet inside this connection
* @param statement The statement associate with this connection
private void closeDbConnection(Connection cont,ResultSet rs,Statement statement)
if (rs != null)
try {
rs.close();
} catch (SQLException ignored) {
ignored.printStackTrace();
if (statement != null)
try {
statement.close();
} catch (SQLException ignored) {
ignored.printStackTrace();
if (cont != null)
try {
cont.close();
} catch (SQLException ignored) {
ignored.printStackTrace();
} //closeDbConnection
EditVendorEntity (Remote Interface)
package code.beans.EditVendor;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
import java.util.*;
* Remote interface for Enterprise Bean: EditVendorEntity
public interface EditVendorEntity extends javax.ejb.EJBObject {
public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax)
throws RemoteException;
public Vector getData() throws RemoteException;
EditVendorEntityHome (Home Interface)
package code.beans.EditVendor;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import javax.ejb.DuplicateKeyException;
import javax.ejb.EJBHome;
import java.util.*;
* Home interface for Enterprise Bean: EditVendorEntity
public interface EditVendorEntityHome extends javax.ejb.EJBHome {
* Creates an instance from a key for Entity Bean: EditVendorEntity
public code.beans.EditVendor.EditVendorEntity create(String vendorid)
throws javax.ejb.CreateException, java.rmi.RemoteException;
* Finds an instance using a key for Entity Bean: EditVendorEntity
public code.beans.EditVendor.EditVendorEntity findByPrimaryKey(
code.beans.EditVendor.EditVendorEntityKey Vendor_ID)
throws javax.ejb.FinderException, java.rmi.RemoteException;
EditVendorEntityKey (Primary Key Class)
package code.beans.EditVendor;
* Key class for Entity Bean: EditVendorEntity
public class EditVendorEntityKey implements java.io.Serializable {
static final long serialVersionUID = 3206093459760846163L;
public String primkey;
* Creates an empty key for Entity Bean: EditVendorEntity
public EditVendorEntityKey() { }
public EditVendorEntityKey(String primarykey) {
this.primkey=primarykey;
public String getVendorId() {
return primkey;
* Returns true if both keys are equal.
public boolean equals(java.lang.Object otherKey) {
if (otherKey instanceof code.beans.EditVendor.EditVendorEntityKey) {
code.beans.EditVendor.EditVendorEntityKey o =
(code.beans.EditVendor.EditVendorEntityKey) otherKey;
return (primkey.equals(otherKey));
return false;
* Returns the hash code for the key.
public int hashCode() {
return (primkey.hashCode());
Please go through and give me your comments and solution...
Thanks in advance
Rahul -
CMP Entity Bean With Primary Key of int
Is it valid to have a CMP Entity Bean (v1.1) where the primary key is defined as the primitive 'int' instead of a true Java class?
Thanks in advance,
MarcHi,
Ur primary key in the EJB cant be a primitive data type. If the primary key in the table is a int,
then u will hv [bold] java.lang.Integer [bold] as the datatype in Entity Bean. If u hv further queries write me at [email protected]
Kesavan. -
JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
Hi,
I am developing a Fusion Web Application using Jdeveloper 11.1.2.1.0. I have a home.jspx page that has a ADF table built on efttBilling View Object. . When you click on one of the rows in the table, it will take you to detail.jspx where you can edit the row and save. When 'save' is clicked, stored procedures are executed to update/insert rows into few tables , and then go back to home.jspx where you need to see updated content for that row.
To get down to the exact issue, updates are made to the tables on which the efttBilling View Object is built using a stored procedure. Once this is done, I am trying to requery view object to see new content. But I keep getting JBO-25014: Another user has changed the row with primary key oracle.jbo.Key error. Following are the approaches I followed to query new results:
a. Executed Application Modules Commit Method. Created 'Commit' Action binding and tied it to homePageDef.xml. Called this binding from a view scope bean.
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty())
return null;
b. Marked 'Refresh on Insert' , 'Refresh on Update', 'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
c. Tried to Requery View Object. Created a refreshViewObject method in Application Module Impl.java file, exposed this method to the client interface and created a invokeMethod Action binding in home.jspx
Code in Application Module:
public void refresheftTransactionsforBillingAccountViewObj1View()
System.out.println("In eftTransactionsforBillingAccountViewObj1");
findViewObject("eftTransactionsforBillingAccountViewObj1").executeQuery();
Code in view scope bean
DCBindingContainer bindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
OperationBinding operation =
bindings.getOperationBinding("refresheftTransactionsforBillingAccountViewObj1View");
operation.execute();
I have searched web, ADF forums and tried methods suggested in there but no sucess.
Could anyone please provide some insight in this issue. I have been battling with this since quite some time. I can provide you with the log file too.
Thanks!
Shai.What code does your Commit method have .. can you try using the Commit executable from the AM itself instead ?
Also -
Shai wrote:
'Change Indicator' checkboxes for all the attributes in the entities associated with efttBilling View Object.
which all attributes you set this property for . it should just be for History columns as such.
Did you also check if this could be your scenario ?
Decompiling ADF Binaries: Yet another reason for "JBO-25014: Another user has changed the row with primary key orac…
OR
JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
OR
Another user has changed the row with primary key -Table changed externally
Message was edited by: SudiptoDesmukh -
Error on commit: Another user has changed the row with primary key : Rec_10
i am using jdev 11g R2
i implemented a master form and two detail tables on a jspx page
added createInsert, commit and rollback buttons
actions from these buttons all are executed from a bean
for entity attributes: refresh after insert and update are marked as checked
i am using login page for authorizing the user by getting the user information from user table
and then using the userid i am applying the setVisible property on some components at bean code
when i am inserting a new row there is no problem, here i am generating the new id like 'Rec_10', using a database sequence
but when i am trying to update a current record, it is showing the error --> Error on commit: JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[Rec_22 ]
on clicking the commit button and also it is not updating the record on database
Thanx in Advance
kumar
Edited by: user10922309 on Nov 18, 2009 3:25 AM
Edited by: user10922309 on Nov 18, 2009 4:28 AMHi John
thnq for your quick responce.
here are the attribute details:
Attribute Name: RecID, Type: String, Value Type: Expression, Value: 'Rec_' + (new oracle.jbo.server.SequenceImpl("Rec_SEQ_AN", object.getDBTransaction())).getSequenceNumber()
Updatable: While New and Primary Key, Queryable, Persistent, Mandatory, Refresh After: Update, Refresh After: Update and Insert are markded as checked
error details:
oracle.jbo.RowInconsistentException: JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[APP_22 ].
at oracle.jbo.server.OracleSQLBuilderImpl.doEntitySelectForAltKey(OracleSQLBuilderImpl.java:1062)
at oracle.jbo.server.BaseSQLBuilderImpl.doEntitySelect(BaseSQLBuilderImpl.java:548)
at oracle.jbo.server.EntityImpl.doSelect(EntityImpl.java:7762)
at oracle.jbo.server.EntityImpl.lock(EntityImpl.java:5554)
at oracle.jbo.server.EntityImpl.beforePost(EntityImpl.java:6057)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6229)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3127)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2935)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1991)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2233)
at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1580)
at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1404)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1289)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2120)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:693)
at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.executeEvent(PageLifecycleImpl.java:394)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding._execute(FacesCtrlActionBinding.java:217)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlActionBinding.execute(FacesCtrlActionBinding.java:201)
--> at Index.saveApplicationAll(Index.java:6246)
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:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:157)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at org.apache.myfaces.trinidadinternal.taglib.util.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:53)
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodBinding(UIXComponentBase.java:1245)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:183)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:673)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:273)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:165)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
--> on click commit button Index.saveApplicationAll method will invoked.
Thats it.
Kumar
Edited by: user10922309 on Nov 18, 2009 4:32 AM -
Another user has changed the row with primary key exception
Hi Experts,
I have a method in AmImpl.java. I am calling this method from my bean. The method opens a JDBC connection(i know it is not a good approach, we should use AM instance, but this was the last option as had tried all) and updates a table in the database. I want the data to be refreshed on screen after update is performed. So, I am doing VO.executeQuery() after i commit the data in the database and that is when i get the exception "Another user has changed the row with primary key exception".
Can you please tell me how to get rid of this error or any other way of doing the above process?I have a screen divided into two parts, i have used a Panel splitter for that. Each pane has a table. Say i edit a record in table 1 and on the basis of changing a flag, the record should move out of table 1 and should go to table 2 in the second pane. the records in table 1 have some priorities defined by the end user, so if a record moves out or is reordered within that table, the rest of the records' priority number also changes. I have achieved all this. Now, when I apply a filter on the table, the record set gets filtered and contains limited set of rows. Now, when i try to achieve the two processes i have mentioned above (moving out or reordering), I need to have a control over the entire rowset because i need to alter the priority numbers accordingly but the VO iterator contains only the filtered set of rows even if I do VO.executeQuery. I was not able to get the entire rowset, so thats when i decided to use JDBC and i am able to successfully update the database. Then after the update, i need to refresh the table on the screen, so I did Vo.executeQuery in the bean after the method was called and I encountered this error. Then, I removed this Vo refresh from the bean and did this.getVO.executeQuery in the AmImpl method, after i commit changes in the database, it was working fine for few days but now it has started flashing the exception "Another user has changed the row with primary key exception".
-
Insert row with datapages/bc4j problem with primary key
Hi everybody,
i tryed to insert a new row into a table with primary key (id) and therfore used a datapage, where there is a html-form and the data tag set attribute to get the data into the BC.
I also want to use a sequence for the primary key and made a trigger to insert the key-value before insert. but in this case it doesnt work. I also tryed to get the sequence to the BC -Layer (so that i can set the PK in the View OBJ already) with a View Object but I dont know how.
so what schould i do??
thanxx
MartinThere's a know issue, when creating a record with blob, the blob content won't show until committing. The blob is added too late, which means you're in trouble with not-null fields...
Sue, is this logged as a bug? And the dialog captions?
K. -
Mapping in OWB with primary key and foreign key relationship
Hi all,
I am new to this datawarehousing field. I have just started my career. I have to now create a mapping in owb where a table has a field which is a primary key of another table in the same staging area. If you guys could help me out with the a method it can be created that would be very helpful to me.
I thought of 2 ideas,
1. If I can use a look up, but then I am not sure if i can use a lookup for primary key, foreign key relationship. If I can use also, I do not know how to use that.
2. What if I can directly take that the first table and link the primary key of that table to the second table which uses that primary key of the first table as one of its fields.
I do not know how feasible these methods are. Please guys help me out.
Thanks in advance.I have a similar case where table a and table b having relation but table a got inserted with data and table b is empty so there no values for foriegn key column in table b to realte with table a.
Now i want to load table b foriegn key with primary key column values of table a.
how can we do this in owb
thanks
kumar -
I have CS2 and would like to do Image Stacking. I understand CS3 allows this. correct? Am I wiser to purchase CS3 upgrade. Am I going to run into issues with install?
Well, I refuse to sign up to pay Adobe a monthly tribute for life too, but that doesn't mean we are limited to CS3.
I'm staying with CS6.
Adobe still sells a perpetual-license to Photoshop CS6 without the subscription model, but it's $700 for the Standard version and a cool $1,000 for the Extended version.
You haven't mentioned your platform, Macintosh or Windows, so make sure CS3 or any other obsolete version you buy actually runs on a modern operating system.
Good luck. -
Another user has changed the row with primary key -Table changed externally
Hello,
I am facing the error: "Another user has changed the row with primary key oracle.jbo.Key[94 ]." during the delete operation.
User case scenario:
1. Added new row in the table.
2. Once new row is added to the the table, another application will update few columns in the newly added row based on some logic.
3. On the same session I am trying to delete the newly added row and getting above mentioned error.
I have added a "Button" in the table to partialRefresh the table to check the new values of the changed columns.
I have checked the forum and found many similar errors and tried the following but nothing helped.
1. By setting "Auto Refresh = True" for the view object.
Issue faced-> It worked fine but after few add and remove my db is getting to inconsistent state after which, I am not able to do any add/delete from my page.
Error: "Too many objects match the primary key oracle.jbo.Key". I have checked this and I am not getting this error when "Auto Refresh = False" even after multiple add and remove actions.
2. By Setting "Auto Refresh" the iterator associated with the page.
Issue -> Did not work at all.
Looking forward inputs from gurus.
Thanks
AbhijeetFinally I found one solution to this problem at: [ http://www.avromroyfaderman.com/2008/05/bring-back-the-hobgoblin-dealing-with-rowinconsistentexception/|http://www.avromroyfaderman.com/2008/05/bring-back-the-hobgoblin-dealing-with-rowinconsistentexception/]
Simply overriding the lock() method in the entity object resolved issue. Kudos to the author.
Code:
public void lock() {
try {
super.lock();
} catch (RowInconsistentException e) {
refresh(REFRESH_WITH_DB_ONLY_IF_UNCHANGED | REFRESH_CONTAINEES);
super.lock();
But, Now my refresh button is not working as depend on the "Auto Refresh = True" to update the table.
Can anyone tell me how can I refresh the VO of my table from the button.
Thanks
Abhijeet.
P.S: I have already added the partial trigger but it is work not working as the data is cached in the VO. Removing the Cached property for the VO is creating other problems. -
JBO-25014: Another user has changed the row with primary key...
Hello,
could you help me please with resolving this error "JBO-25014: Another user has changed the row with primary key..." - I am just getting a row from a view by bind "filter" variable, then I am assigning new values for some of the attributes - and trying to commit ..unsuccessfully..
View is based on Entity.
I saw directive for setting Entity's attributes as "update after insert / update" - but this did not help me.
Thanks in advance.Hi
Please try this solutions:
One solution is to change the ADF BC locking behavior to optimistic instead of pessimistic. Choose the AM and click the Configuration context menu option. Select the LocalAM entry and go to the Properties. Scroll down to the locking setting and change the existing entry
If there is a trigger changing values, you need to mark those attributes (the ones that may be changed) as refresh after insert and/or refresh after update in your Entity Object. -
Another user has changed the row with primary key oracle.jbo.Key
Oracle Jdeveloper 11.1.2.1
ADFbc + JSF
I have a Page ( Purchase Order Status) (which show all PO to be approved) from this page (page1) the Supervison can call Regular PO (Page2) and change whatever he needs to change. (products, quantities, discounts,warehouse...)
then on Page2 he invoke (commit) after his changes and return to page1, when supervisor change the status to Approved on page1. I get this Error (Another user has changed the row with primary key oracle.jbo.Key[#]).
for sure there are no another user changing this PO.
both page are based on same Entity Object (PO) , how can I solve this Issue? thank youhi,
This occur due to pessimistic locking mode for ApplicationModule ,alter to optimistic and check following sample to get knowledge about locking mode.
http://andrejusb.blogspot.com/2010/03/optimistic-and-pessimistic-locking-in.html-Suersh
Maybe you are looking for
-
Problem in Azure SQL Database Basic Tier
I have a WinForms Application was using Azure SQL Database (Web) It was working fine with web version (for last 2.5 years). After Microsfot's new offerings of New Tiers of Azure SQL Database, I tried Basic Tier. Observation for last 24 hours accord
-
I don't understand the licensing, support and platforms zones run on. 1) Are zones supported on X86 Solaris? 2) Are they available in OpenSolaris x86? 3) I saw a demonstration of a really nice gui tool to configure and move zones, (Container Manager?
-
In may network envirounments there is a proxy server. I mean, at the office there is one, at the University another one, at home none... Every time I get a new place of this I have to change manually the proxy configuration. I think this is not so co
-
Hello everyone, I'm having trouble using the Connector.open method to construct a ServerSocketConnection instance. I use the following code: ServerSocketConnection serv = (ServerSocketConnection) Connector.open("socket://:80"); I get the following ex
-
Manually running some tape archives from each of the various protection groups on our DPM2010 server (tape drive is standalone Quantum LTO5 - 1.5/3.0 TB). Co-location is enabled. Everything backs up normally, with the exception of any job from a new