You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by balaji sampath <bi...@hotmail.com> on 2004/05/09 16:08:31 UTC
Inconsistence in Persistence Broker
Hello,
I have been using OJB with jakarta struts and having MYSQL 4 has database.
When I create an object for Persistance Broker and try to insert values into
three of my tables.
Here is my insert method of my DAO object
public void insert(EmployeeVO employeevo,DepartVO departvo,RoleVO rolevo)
throws DataAccessException {
log.info("inside EmployeeDAO.insert");
PersistenceBroker broker = null;
try {
broker = ServiceLocator.getInstance().findBroker();
broker.beginTransaction();
broker.store(employeevo);
broker.store(departvo);
broker.store(rolevo);
broker.commitTransaction();
}
.......................
The insertion of rows into the three tables was not a consistent one.It
correctly inserts the rows into three tables in few cases or gives an
exception PersistenceBrokerException: Message From server "Duplicate Entry
1-2345 for key 1"
When i looked into the employee table the row was properly inserted and the
rows are not inserted into the rest of the two tables.I felt that the error
was due to the persistance broker trying to insert the row in the employee
table which was the first table for the second time after it has been
inserted into the first time itself.That is the persistence broker is
getting restarted.The execution of the code is inconsistent.
Could anyone in this group help to solve this problem.Expecting for a
solution from you all.
Thanking You,
bill.
_________________________________________________________________
Best of Indian handicrafts.
http://www.fabmall.com/affiliatehtml/redir/nl8.asp At MSN Shopping.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Inconsistence in Persistence Broker
Posted by Armin Waibel <ar...@apache.org>.
Hi,
difficult to analyse what's going wrong. Are there associations between
Employee, Department and Role? If yes, do you set auto-update 'true' or
'object'? Do you change any settings in OJB.properties file? Do you use
one PB instance per thread (PB instances are not threadsafe)?
regards,
Armin
balaji sampath wrote:
> Hello,
>
> I have been using OJB with jakarta struts and having MYSQL 4 has database.
>
> When I create an object for Persistance Broker and try to insert values
> into three of my tables.
>
> Here is my insert method of my DAO object
>
> public void insert(EmployeeVO employeevo,DepartVO departvo,RoleVO
> rolevo) throws DataAccessException {
> log.info("inside EmployeeDAO.insert");
> PersistenceBroker broker = null;
> try {
> broker = ServiceLocator.getInstance().findBroker();
> broker.beginTransaction();
> broker.store(employeevo);
> broker.store(departvo);
> broker.store(rolevo);
> broker.commitTransaction();
> }
> .......................
>
> The insertion of rows into the three tables was not a consistent one.It
> correctly inserts the rows into three tables in few cases or gives an
> exception PersistenceBrokerException: Message From server "Duplicate
> Entry 1-2345 for key 1"
>
> When i looked into the employee table the row was properly inserted and
> the rows are not inserted into the rest of the two tables.I felt that
> the error was due to the persistance broker trying to insert the row in
> the employee table which was the first table for the second time after
> it has been inserted into the first time itself.That is the persistence
> broker is getting restarted.The execution of the code is inconsistent.
>
> Could anyone in this group help to solve this problem.Expecting for a
> solution from you all.
>
> Thanking You,
>
> bill.
>
> _________________________________________________________________
> Best of Indian handicrafts.
> http://www.fabmall.com/affiliatehtml/redir/nl8.asp At MSN Shopping.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org