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 Xu Jie <ji...@siemens.com> on 2003/07/07 21:53:06 UTC

Question on Tutorial1

All,

I am new to this ObJectRelationalBridge (OJB) project. So I used Tutorial1
to teach myself something about OJB. It works fine according to the online
doc in my DOS console. Next I did is to move only needed files (jar, xml
...) to my development environment. After some work, the Tutorial starts
working in my development environment with one interesting exception. I have
to use option 1 first to enter new record. If I use option 0 to view list
first, I will get following message when I try to enter new one,
[org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO: Rollback was
called, do rollback on current connection org.hsqldb.jdbcConnection@6f216530
ConnectionManager is NOT in transaction
But if I do option 1 first, I do not see any problem at all.
Thank you for your help,  




-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to CSOffice@smed.com.  Thank you

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Question on Tutorial1

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi,

----- Original Message -----
From: "Xu Jie" <ji...@siemens.com>
To: <oj...@db.apache.org>
Sent: Monday, July 07, 2003 9:53 PM
Subject: Question on Tutorial1


>
> All,
>
> I am new to this ObJectRelationalBridge (OJB) project. So I used
Tutorial1
> to teach myself something about OJB. It works fine according to the
online
> doc in my DOS console. Next I did is to move only needed files (jar,
xml
> ...) to my development environment. After some work, the Tutorial
starts
> working in my development environment with one interesting exception.
I have
> to use option 1 first to enter new record. If I use option 0 to view
list
> first, I will get following message when I try to enter new one,
> [org.apache.ojb.broker.accesslayer.ConnectionManagerImpl] INFO:
Rollback was
> called, do rollback on current connection
org.hsqldb.jdbcConnection@6f216530
> ConnectionManager is NOT in transaction
> But if I do option 1 first, I do not see any problem at all.

Hhm, do you use multiple threads and share the
same broker?
Tutorial1 use a 'special' construct to show single
aspects of OJB. In 'real life' you should use OJB
in an more simple manner

PersistenceBroker broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
try{
broker.beginTransaction();
broker.store(anObject);
broker.commitTransaction()
}catch(PersistenceBrokerException e)
{
broker.abortTransaction()
}
finally
{
broker.close();
}

PersistenceBroker instances are pooled, thus PB lookup
has no performance impact. PB instance itself is not
thread safe. Use one PB instance per thread or on
every method call.

HTH
regards,
Armin
> Thank you for your help,
>
>
>
>
> ----------------------------------------------------------------------
---------
> This message and any included attachments are from Siemens Medical
Solutions
> USA, Inc. and are intended only for the addressee(s).
> The information contained herein may include trade secrets or
privileged or
> otherwise confidential information.  Unauthorized review, forwarding,
printing,
> copying, distributing, or using such information is strictly
prohibited and may
> be unlawful.  If you received this message in error, or have reason to
believe
> you are not authorized to receive it, please promptly delete this
message and
> notify the sender by e-mail with a copy to CSOffice@smed.com.  Thank
you
>
> ---------------------------------------------------------------------
> 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