objectbridge-developers Mailing List for ObJectRelationalBridge (Page 41)
Brought to you by:
thma
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(14) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(33) |
Feb
(8) |
Mar
(3) |
Apr
(1) |
May
(18) |
Jun
(6) |
Jul
(15) |
Aug
(71) |
Sep
(29) |
Oct
(43) |
Nov
(77) |
Dec
(54) |
2002 |
Jan
(54) |
Feb
(147) |
Mar
(144) |
Apr
(163) |
May
(307) |
Jun
(240) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: <ri...@ya...> - 2002-01-31 15:02:43
|
Hello, As I said before, when 2 users try to use the same part of the = "manager", one of them gets an Exception, the other process it = correctly. Maybe it's because of the fact that I'm using ONE "odmg instance" = (odmg=3DOJB.getInstance()) in my manager singleton. In every invocation = of a function in this manager, I use: Transaction tx =3D odmg.newTransaction() So, aparently it's not a problem. But I'm not sure... This is the complete stack trace, when 2 users access the same function: -------------------------------------------------------------------------= [ODMG] ERROR: null org.odmg.QueryException at ojb.odmg.oql.OQLQueryImpl.execute(OQLQueryImpl.java:251) at = charlie.ojb.ProyectoManagerOJB.tareasPorEmpleado(ProyectoManagerOJB.j ava) at org.apache.jsp.main$jsp._jspService(main$jsp.java:110) at = org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at = org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspSer vlet.java:202) at = org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3 82) at = org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at = org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDisp atcher.java:679) at = org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationD ispatcher.java:431) at = org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDis patcher.java:355) at = org.apache.struts.action.ActionServlet.processActionForward(ActionSer vlet.java:1759) at = org.apache.struts.action.ActionServlet.process(ActionServlet.java:159 6) at = org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at = org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl icationFilterChain.java:247) at = org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF ilterChain.java:193) at = org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV alve.java:243) at = org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at = org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at = org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at = org.apache.catalina.core.StandardContextValve.invoke(StandardContextV alve.java:201) at = org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at = org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at = org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at = org.apache.catalina.core.StandardContext.invoke(StandardContext.java: 2344) at = org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j ava:164) at = org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at = org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche rValve.java:170) at = org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:564) at = org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j ava:170) at = org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:564) at = org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 462) at = org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:564) at = org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at = org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at = org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal ve.java:163) at = org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline .java:566) at = org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav a:472) at = org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at = org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso r.java:1011) at = org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja va:1106) at java.lang.Thread.run(Thread.java:484) -------------------------------------------------------------------------= --- I'm NOT using OJB in C/S mode. The "TransactionInProgressException = problem" was related to OJB in C/S mode, this one is ANOTHER problem, as = you can see in the satck trace. I hope the patch helps solucionate the C/S problem, but this one seems = to be another issue, am I right? Thanks for your help! Greetings, Ricardo Arguello ri...@ya... ----- Original Message -----=20 From: "Mahler Thomas" <tho...@it...> To: "'Ricardo Arg=FCello'" <ri...@ya...>; "ojb" = <obj...@li...> Sent: Thursday, January 31, 2002 8:04 AM Subject: AW: [OJB-developers] Re: OJB in C/S mode: = TransactionInProgressEx Hi again Ricardo, The bugfix is on the way. I hope to get it posted today! > -----Urspr=FCngliche Nachricht----- > Von: Ricardo Arg=FCello [mailto:ri...@ya...] > Gesendet: Mittwoch, 30. Januar 2002 22:43 > An: ojb > Betreff: Re: [OJB-developers] Re: OJB in C/S mode: > TransactionInProgressEx >=20 >=20 > Hello, >=20 > Thanks for your reply. >=20 > I have a "manager class" wich is called from my Struts=20 > actions, and it does al the work, calling the "OJBed=20 > classes", retuning Collections, etc. >=20 > This manager is a singleton, and when I instanciate it (only=20 > once) I initialize the "odmg" class variable: >=20 > public class ProyectoManagerOJB { > private static final String databaseName =3D > =20 > PersistenceBrokerFactory.getConfiguration().getRepositoryFilename(); >=20 > private Implementation odmg; // maybe this is wrong!=20 This absolutely ok. OJB.getInstance() is a singleton > public ProyectoManagerOJB() { > odmg =3D OJB.getInstance(); > Database db =3D odmg.newDatabase(); > try { > db.open(databaseName, Database.OPEN_READ_WRITE); > } catch (ODMGException ex) { > ex.printStackTrace(); > } > } > ... > } >=20 > Struts actions call functions in this class: >=20 > ProyectoManager pm =3D ProyectoManager.getInstance(); // it's=20 > an abstract factory, returns ProyectoManagerOJB > User user =3D pm.getUser("john"); >=20 > The corresponding class in ProyectoManagerOJB is this one:=20 > (User is an interface, UserOJB implements it) >=20 > public User getUser(String user) { > try { > Transaction tx =3D odmg.newTransaction(); > tx.begin(); > OQLQuery query =3D odmg.newOQLQuery(); > query.create( > "select p from " > + charlie.ojb.UserOJB.class.getName() > + " where user =3D \"" > + user > + "\""); > DList result =3D (DList) query.execute(); > User user =3D (User) result.get(0); > tx.commit(); > return user; > } catch (Exception e) { > e.printStackTrace(); > return null; > } > } >=20 > As you can see, in getUser() I use the class variable "odmg".=20 That's OK! > If I have two users login in, I get a TransactionInProgressException. Please send me a complete stacktrace of this exception. I'm not sure if = it is a PersistenceBrokerException or an ODMGException. > I believe it is because of the fact that odmg is an instance variable. >=20 > So, could you send me some code examples of your=20 > friends'"odmg helper class" to see how I could implement it=20 > in my architecture? >=20 I'll will post it to you later this day. > Thanks in advance! >=20 > Greetings from Quito, Ecuador >=20 greetings from Essen, Germany=20 Thomas > Ricardo Arguello > ri...@ya... >=20 >=20 > ----- Original Message -----=20 > From: "Thomas Mahler" <tho...@ho...> > To: "Ricardo Arguello" <ri...@ya...>; "ojb"=20 > <obj...@li...> > Sent: Wednesday, January 30, 2002 3:35 PM > Subject: [OJB-developers] Re: OJB in C/S mode: TransactionInProgressEx >=20 >=20 > > Hi Ricardo, > >=20 > > sorry for the trouble OJB is causing for you. > > We'll try to get a solution for this soon. > >=20 > > Ricardo Arguello wrote: > >=20 > > > Hello, > > >=20 > > > As I said before, I'm getting a=20 > > > TransactionInProgressException when I use OJB in=20 > > > Client/Server mode. > > >=20 > > > I tried changing the log to DEBUG, bit it imposibe for me=20 > > > to distinguish any of the errors, there is a LOT of DEBUG=20 > > > messages, of the following style: > > >=20 > >=20 > >=20 > >=20 > > Yup, sometimes it's hard to know which part of the system=20 > might write=20 > > the relevant log infos... > >=20 > >=20 > > >=20 > > > [ojb.broker.server.RequestProcessor] DEBUG: OJB=20 > > > RequestProcessor 2 waiting... > > > [ojb.broker.server.RequestProcessor] DEBUG: OJB=20 > > > RequestProcessor 7 working... > > > [ojb.broker.server.RequestProcessor] DEBUG: dispatching [24, > > > [ojb.broker.server.RequestProcessor] DEBUG: -1, > > > [ojb.broker.server.RequestProcessor] DEBUG: class=20 > > > charlie.ojb.EmpleadoOJB, > > > [ojb.broker.server.RequestProcessor] DEBUG: null] > > > [ojb.broker.server.BrokerPool] DEBUG: getFreeBrokerId: 1,=20 > > > remaining: [1, 1, 1, 1 > > > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3,=20 > > > 1, 1, 1, 1, 1, 1, 3, > > > 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, 1 > > > , 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 5, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 8,=20 > > > 1, 1, 1, 9, 1, 1, 9, 1 > > > , 1, 1, 1, 1, 1, 0, 1, 9, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, 1 > > > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] > > >=20 > > >=20 > > > Awful, right? > >=20 > >=20 > > Yes that's awful to read. But it is also a clear indicator=20 > that there=20 > > must be a bug in the BrokerPool. It should contain exactly=20 > ten brokers=20 > > numbered from 0 - 9. > > As the list you see contains a lot of "1" entries you are=20 > served with=20 > > the same broker instance for multiple transactions. > >=20 > > This is definitely a severe bug. > >=20 > > I will start working on it asap and hope to have a fix by=20 > the weekend. > >=20 > >=20 > > >=20 > > > I cannot find the errors I metioned in my previous=20 > > > message... But my application stil acts the same: Two=20 > > > persons can't even login at the same time, one of them gets=20 > > > a stack trace... > > >=20 > >=20 > >=20 > > I assume that it is all related to the above error ! > >=20 > >=20 > > > I was reading the Locking document, and I tried to add a=20 > > > isolation=3D"read-uncommitted" to all my class definitions in=20 > > > the repository.xml file, but tha doesn't help either. > >=20 > >=20 > > This is definitely a locking problem. OJB uses read-uncommited by=20 > > default already. In the case of locking problems you would=20 > get a ODMG=20 > > LockNotGrantedException! > >=20 > > > How=20 > > > should I declare my lockings? In the XML file, in my code=20 > > > (you say the ODMG doesnt dictate a way to that). > > >=20 > >=20 > >=20 > > Locking is declared in the repository only. ODMG specifies=20 > no API for=20 > > setting locklevels. > >=20 > >=20 > > >=20 > > > Please clarify this to me? Do I need to do C/S to use OJB=20 > > > in a web application? > >=20 > >=20 > >=20 > > Hmm. I know of people who are using OJB in singlevm mode in=20 > Web apps. > > As long as the commit phase of ODMG transactions is=20 > relatively short=20 > > there won't be much problems. > >=20 > > I'm intending to have brokerpool for the singlevm mode too.=20 > then it will=20 > > be totally safe to use the singlevm mode which is much faster !!! > >=20 > >=20 > > > Wouldn't a "OJB Helper" with a single Database instance=20 > > > (singleton) be enough? > > >=20 > >=20 > >=20 > > Yes that should be sufficient. > >=20 > >=20 > > > If that's the case, how could I implement that?=20 > >=20 > >=20 > > Hmm, I'm not quite sure what you want to implement exactly? > >=20 > >=20 > > > Is OJB thread safe?=20 > >=20 > >=20 > > Yes > >=20 > > >How can I use OJB with Tomcat + Struts? > >=20 > >=20 > > A colleague of mine used Struts and the OJB ODMG api sucessfully. > > He defined special STruts actions that used ODMG=20 > transactions to do the=20 > > persistence work. It's pretty straightforward. > >=20 > > If you are interested I might post you sample code for this. > >=20 > >=20 > > > How can I assure that 2 transactions can READ at the same=20 > > > time, without locking? > > >=20 > >=20 > >=20 > > Currently the OJB ODMG implementation relies on pessimistic locking. > > There is currently no optimistic locking support. (will be=20 > there in 1.0) > >=20 > > But if you use "uncommitted-read" there should be no=20 > locking problems. > > You can do even more do avoid lock conflicts through WRITE=20 > operations. > > In OJB.properties you'll find an entry LockAssociations set=20 > this to READ. > >=20 > > The LockAssociations entry defines the behaviour for the OJB > > implicit locking feature. If set to WRITE (default)=20 > acquiring a write- > > lock on a given object x implies write locks on all objects=20 > associated > > to x. If set to READ implicit read-locks are acquired. > > Acquiring a read-lock on x thus allways results in implicit=20 > read-locks > > on all associated objects. > >=20 > > Using uncommited reads in combination with=20 > LockAssociation=3DREAD will=20 > > reduce Locking related problems to a minimum. > >=20 > > But as I said before: your problem is NOT related to locking. > >=20 > >=20 > > >=20 > > > Thanks in advance. > > >=20 > > > Ricardo Arguello (an ex-Castor refugee) > >=20 > >=20 > > I'll work hard to ensure you won't become an OJB refugee ;-) > >=20 > >=20 > > cu, > >=20 > > Thomas > >=20 > >=20 > >=20 > > _______________________________________________ > > Objectbridge-developers mailing list > > Obj...@li... > > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > >=20 >=20 >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 _______________________________________________ Objectbridge-developers mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-developers |
From: Mahler T. <tho...@it...> - 2002-01-31 13:05:22
|
Hi again Ricardo, The bugfix is on the way. I hope to get it posted today! > -----Urspr=FCngliche Nachricht----- > Von: Ricardo Arg=FCello [mailto:ri...@ya...] > Gesendet: Mittwoch, 30. Januar 2002 22:43 > An: ojb > Betreff: Re: [OJB-developers] Re: OJB in C/S mode: > TransactionInProgressEx >=20 >=20 > Hello, >=20 > Thanks for your reply. >=20 > I have a "manager class" wich is called from my Struts=20 > actions, and it does al the work, calling the "OJBed=20 > classes", retuning Collections, etc. >=20 > This manager is a singleton, and when I instanciate it (only=20 > once) I initialize the "odmg" class variable: >=20 > public class ProyectoManagerOJB { > private static final String databaseName =3D > =20 > PersistenceBrokerFactory.getConfiguration().getRepositoryFilename(); >=20 > private Implementation odmg; // maybe this is wrong!=20 This absolutely ok. OJB.getInstance() is a singleton > public ProyectoManagerOJB() { > odmg =3D OJB.getInstance(); > Database db =3D odmg.newDatabase(); > try { > db.open(databaseName, Database.OPEN_READ_WRITE); > } catch (ODMGException ex) { > ex.printStackTrace(); > } > } > ... > } >=20 > Struts actions call functions in this class: >=20 > ProyectoManager pm =3D ProyectoManager.getInstance(); // it's=20 > an abstract factory, returns ProyectoManagerOJB > User user =3D pm.getUser("john"); >=20 > The corresponding class in ProyectoManagerOJB is this one:=20 > (User is an interface, UserOJB implements it) >=20 > public User getUser(String user) { > try { > Transaction tx =3D odmg.newTransaction(); > tx.begin(); > OQLQuery query =3D odmg.newOQLQuery(); > query.create( > "select p from " > + charlie.ojb.UserOJB.class.getName() > + " where user =3D \"" > + user > + "\""); > DList result =3D (DList) query.execute(); > User user =3D (User) result.get(0); > tx.commit(); > return user; > } catch (Exception e) { > e.printStackTrace(); > return null; > } > } >=20 > As you can see, in getUser() I use the class variable "odmg".=20 That's OK! > If I have two users login in, I get a TransactionInProgressException. Please send me a complete stacktrace of this exception. I'm not sure if = it is a PersistenceBrokerException or an ODMGException. > I believe it is because of the fact that odmg is an instance = variable. >=20 > So, could you send me some code examples of your=20 > friends'"odmg helper class" to see how I could implement it=20 > in my architecture? >=20 I'll will post it to you later this day. > Thanks in advance! >=20 > Greetings from Quito, Ecuador >=20 greetings from Essen, Germany=20 Thomas > Ricardo Arguello > ri...@ya... >=20 >=20 > ----- Original Message -----=20 > From: "Thomas Mahler" <tho...@ho...> > To: "Ricardo Arguello" <ri...@ya...>; "ojb"=20 > <obj...@li...> > Sent: Wednesday, January 30, 2002 3:35 PM > Subject: [OJB-developers] Re: OJB in C/S mode: = TransactionInProgressEx >=20 >=20 > > Hi Ricardo, > >=20 > > sorry for the trouble OJB is causing for you. > > We'll try to get a solution for this soon. > >=20 > > Ricardo Arguello wrote: > >=20 > > > Hello, > > >=20 > > > As I said before, I'm getting a=20 > > > TransactionInProgressException when I use OJB in=20 > > > Client/Server mode. > > >=20 > > > I tried changing the log to DEBUG, bit it imposibe for me=20 > > > to distinguish any of the errors, there is a LOT of DEBUG=20 > > > messages, of the following style: > > >=20 > >=20 > >=20 > >=20 > > Yup, sometimes it's hard to know which part of the system=20 > might write=20 > > the relevant log infos... > >=20 > >=20 > > >=20 > > > [ojb.broker.server.RequestProcessor] DEBUG: OJB=20 > > > RequestProcessor 2 waiting... > > > [ojb.broker.server.RequestProcessor] DEBUG: OJB=20 > > > RequestProcessor 7 working... > > > [ojb.broker.server.RequestProcessor] DEBUG: dispatching [24, > > > [ojb.broker.server.RequestProcessor] DEBUG: -1, > > > [ojb.broker.server.RequestProcessor] DEBUG: class=20 > > > charlie.ojb.EmpleadoOJB, > > > [ojb.broker.server.RequestProcessor] DEBUG: null] > > > [ojb.broker.server.BrokerPool] DEBUG: getFreeBrokerId: 1,=20 > > > remaining: [1, 1, 1, 1 > > > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3,=20 > > > 1, 1, 1, 1, 1, 1, 3, > > > 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, 1 > > > , 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 5, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 8,=20 > > > 1, 1, 1, 9, 1, 1, 9, 1 > > > , 1, 1, 1, 1, 1, 0, 1, 9, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, 1 > > > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > > 1, 1, 1, 1, 1, 1, 1, > > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] > > >=20 > > >=20 > > > Awful, right? > >=20 > >=20 > > Yes that's awful to read. But it is also a clear indicator=20 > that there=20 > > must be a bug in the BrokerPool. It should contain exactly=20 > ten brokers=20 > > numbered from 0 - 9. > > As the list you see contains a lot of "1" entries you are=20 > served with=20 > > the same broker instance for multiple transactions. > >=20 > > This is definitely a severe bug. > >=20 > > I will start working on it asap and hope to have a fix by=20 > the weekend. > >=20 > >=20 > > >=20 > > > I cannot find the errors I metioned in my previous=20 > > > message... But my application stil acts the same: Two=20 > > > persons can't even login at the same time, one of them gets=20 > > > a stack trace... > > >=20 > >=20 > >=20 > > I assume that it is all related to the above error ! > >=20 > >=20 > > > I was reading the Locking document, and I tried to add a=20 > > > isolation=3D"read-uncommitted" to all my class definitions in=20 > > > the repository.xml file, but tha doesn't help either. > >=20 > >=20 > > This is definitely a locking problem. OJB uses read-uncommited by=20 > > default already. In the case of locking problems you would=20 > get a ODMG=20 > > LockNotGrantedException! > >=20 > > > How=20 > > > should I declare my lockings? In the XML file, in my code=20 > > > (you say the ODMG doesnt dictate a way to that). > > >=20 > >=20 > >=20 > > Locking is declared in the repository only. ODMG specifies=20 > no API for=20 > > setting locklevels. > >=20 > >=20 > > >=20 > > > Please clarify this to me? Do I need to do C/S to use OJB=20 > > > in a web application? > >=20 > >=20 > >=20 > > Hmm. I know of people who are using OJB in singlevm mode in=20 > Web apps. > > As long as the commit phase of ODMG transactions is=20 > relatively short=20 > > there won't be much problems. > >=20 > > I'm intending to have brokerpool for the singlevm mode too.=20 > then it will=20 > > be totally safe to use the singlevm mode which is much faster !!! > >=20 > >=20 > > > Wouldn't a "OJB Helper" with a single Database instance=20 > > > (singleton) be enough? > > >=20 > >=20 > >=20 > > Yes that should be sufficient. > >=20 > >=20 > > > If that's the case, how could I implement that?=20 > >=20 > >=20 > > Hmm, I'm not quite sure what you want to implement exactly? > >=20 > >=20 > > > Is OJB thread safe?=20 > >=20 > >=20 > > Yes > >=20 > > >How can I use OJB with Tomcat + Struts? > >=20 > >=20 > > A colleague of mine used Struts and the OJB ODMG api sucessfully. > > He defined special STruts actions that used ODMG=20 > transactions to do the=20 > > persistence work. It's pretty straightforward. > >=20 > > If you are interested I might post you sample code for this. > >=20 > >=20 > > > How can I assure that 2 transactions can READ at the same=20 > > > time, without locking? > > >=20 > >=20 > >=20 > > Currently the OJB ODMG implementation relies on pessimistic = locking. > > There is currently no optimistic locking support. (will be=20 > there in 1.0) > >=20 > > But if you use "uncommitted-read" there should be no=20 > locking problems. > > You can do even more do avoid lock conflicts through WRITE=20 > operations. > > In OJB.properties you'll find an entry LockAssociations set=20 > this to READ. > >=20 > > The LockAssociations entry defines the behaviour for the OJB > > implicit locking feature. If set to WRITE (default)=20 > acquiring a write- > > lock on a given object x implies write locks on all objects=20 > associated > > to x. If set to READ implicit read-locks are acquired. > > Acquiring a read-lock on x thus allways results in implicit=20 > read-locks > > on all associated objects. > >=20 > > Using uncommited reads in combination with=20 > LockAssociation=3DREAD will=20 > > reduce Locking related problems to a minimum. > >=20 > > But as I said before: your problem is NOT related to locking. > >=20 > >=20 > > >=20 > > > Thanks in advance. > > >=20 > > > Ricardo Arguello (an ex-Castor refugee) > >=20 > >=20 > > I'll work hard to ensure you won't become an OJB refugee ;-) > >=20 > >=20 > > cu, > >=20 > > Thomas > >=20 > >=20 > >=20 > > _______________________________________________ > > Objectbridge-developers mailing list > > Obj...@li... > > = https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > >=20 >=20 >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: <ri...@ya...> - 2002-01-30 21:43:11
|
Hello, Thanks for your reply. I have a "manager class" wich is called from my Struts actions, and it = does al the work, calling the "OJBed classes", retuning Collections, = etc. This manager is a singleton, and when I instanciate it (only once) I = initialize the "odmg" class variable: public class ProyectoManagerOJB { private static final String databaseName =3D PersistenceBrokerFactory.getConfiguration().getRepositoryFilename(); private Implementation odmg; // maybe this is wrong! public ProyectoManagerOJB() { odmg =3D OJB.getInstance(); Database db =3D odmg.newDatabase(); try { db.open(databaseName, Database.OPEN_READ_WRITE); } catch (ODMGException ex) { ex.printStackTrace(); } } ... } Struts actions call functions in this class: ProyectoManager pm =3D ProyectoManager.getInstance(); // it's an = abstract factory, returns ProyectoManagerOJB User user =3D pm.getUser("john"); The corresponding class in ProyectoManagerOJB is this one: (User is an = interface, UserOJB implements it) public User getUser(String user) { try { Transaction tx =3D odmg.newTransaction(); tx.begin(); OQLQuery query =3D odmg.newOQLQuery(); query.create( "select p from " + charlie.ojb.UserOJB.class.getName() + " where user =3D \"" + user + "\""); DList result =3D (DList) query.execute(); User user =3D (User) result.get(0); tx.commit(); return user; } catch (Exception e) { e.printStackTrace(); return null; } } As you can see, in getUser() I use the class variable "odmg". If I have = two users login in, I get a TransactionInProgressException. I believe it is because of the fact that odmg is an instance variable. So, could you send me some code examples of your friends'"odmg helper = class" to see how I could implement it in my architecture? Thanks in advance! Greetings from Quito, Ecuador Ricardo Arguello ri...@ya... ----- Original Message -----=20 From: "Thomas Mahler" <tho...@ho...> To: "Ricardo Arguello" <ri...@ya...>; "ojb" = <obj...@li...> Sent: Wednesday, January 30, 2002 3:35 PM Subject: [OJB-developers] Re: OJB in C/S mode: TransactionInProgressEx > Hi Ricardo, >=20 > sorry for the trouble OJB is causing for you. > We'll try to get a solution for this soon. >=20 > Ricardo Arguello wrote: >=20 > > Hello, > >=20 > > As I said before, I'm getting a=20 > > TransactionInProgressException when I use OJB in=20 > > Client/Server mode. > >=20 > > I tried changing the log to DEBUG, bit it imposibe for me=20 > > to distinguish any of the errors, there is a LOT of DEBUG=20 > > messages, of the following style: > >=20 >=20 >=20 >=20 > Yup, sometimes it's hard to know which part of the system might write=20 > the relevant log infos... >=20 >=20 > >=20 > > [ojb.broker.server.RequestProcessor] DEBUG: OJB=20 > > RequestProcessor 2 waiting... > > [ojb.broker.server.RequestProcessor] DEBUG: OJB=20 > > RequestProcessor 7 working... > > [ojb.broker.server.RequestProcessor] DEBUG: dispatching [24, > > [ojb.broker.server.RequestProcessor] DEBUG: -1, > > [ojb.broker.server.RequestProcessor] DEBUG: class=20 > > charlie.ojb.EmpleadoOJB, > > [ojb.broker.server.RequestProcessor] DEBUG: null] > > [ojb.broker.server.BrokerPool] DEBUG: getFreeBrokerId: 1,=20 > > remaining: [1, 1, 1, 1 > > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3,=20 > > 1, 1, 1, 1, 1, 1, 3, > > 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1,=20 > > 1, 1, 1, 1, 1, 1, 1, > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > 1, 1, 1, 1, 1, 1, 1, 1 > > , 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > 1, 1, 1, 5, 1, 1, 1, > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1,=20 > > 1, 1, 1, 1, 1, 1, 1, > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 8,=20 > > 1, 1, 1, 9, 1, 1, 9, 1 > > , 1, 1, 1, 1, 1, 0, 1, 9, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1,=20 > > 1, 1, 1, 1, 1, 1, 1, > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,=20 > > 1, 1, 1, 1, 1, 1, 1, > > 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > 1, 1, 1, 1, 1, 1, 1, 1 > > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,=20 > > 1, 1, 1, 1, 1, 1, 1, > > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] > >=20 > >=20 > > Awful, right? >=20 >=20 > Yes that's awful to read. But it is also a clear indicator that there=20 > must be a bug in the BrokerPool. It should contain exactly ten brokers = > numbered from 0 - 9. > As the list you see contains a lot of "1" entries you are served with=20 > the same broker instance for multiple transactions. >=20 > This is definitely a severe bug. >=20 > I will start working on it asap and hope to have a fix by the weekend. >=20 >=20 > >=20 > > I cannot find the errors I metioned in my previous=20 > > message... But my application stil acts the same: Two=20 > > persons can't even login at the same time, one of them gets=20 > > a stack trace... > >=20 >=20 >=20 > I assume that it is all related to the above error ! >=20 >=20 > > I was reading the Locking document, and I tried to add a=20 > > isolation=3D"read-uncommitted" to all my class definitions in=20 > > the repository.xml file, but tha doesn't help either. >=20 >=20 > This is definitely a locking problem. OJB uses read-uncommited by=20 > default already. In the case of locking problems you would get a ODMG=20 > LockNotGrantedException! >=20 > > How=20 > > should I declare my lockings? In the XML file, in my code=20 > > (you say the ODMG doesnt dictate a way to that). > >=20 >=20 >=20 > Locking is declared in the repository only. ODMG specifies no API for=20 > setting locklevels. >=20 >=20 > >=20 > > Please clarify this to me? Do I need to do C/S to use OJB=20 > > in a web application? >=20 >=20 >=20 > Hmm. I know of people who are using OJB in singlevm mode in Web apps. > As long as the commit phase of ODMG transactions is relatively short=20 > there won't be much problems. >=20 > I'm intending to have brokerpool for the singlevm mode too. then it = will=20 > be totally safe to use the singlevm mode which is much faster !!! >=20 >=20 > > Wouldn't a "OJB Helper" with a single Database instance=20 > > (singleton) be enough? > >=20 >=20 >=20 > Yes that should be sufficient. >=20 >=20 > > If that's the case, how could I implement that?=20 >=20 >=20 > Hmm, I'm not quite sure what you want to implement exactly? >=20 >=20 > > Is OJB thread safe?=20 >=20 >=20 > Yes >=20 > >How can I use OJB with Tomcat + Struts? >=20 >=20 > A colleague of mine used Struts and the OJB ODMG api sucessfully. > He defined special STruts actions that used ODMG transactions to do = the=20 > persistence work. It's pretty straightforward. >=20 > If you are interested I might post you sample code for this. >=20 >=20 > > How can I assure that 2 transactions can READ at the same=20 > > time, without locking? > >=20 >=20 >=20 > Currently the OJB ODMG implementation relies on pessimistic locking. > There is currently no optimistic locking support. (will be there in = 1.0) >=20 > But if you use "uncommitted-read" there should be no locking problems. > You can do even more do avoid lock conflicts through WRITE operations. > In OJB.properties you'll find an entry LockAssociations set this to = READ. >=20 > The LockAssociations entry defines the behaviour for the OJB > implicit locking feature. If set to WRITE (default) acquiring a write- > lock on a given object x implies write locks on all objects associated > to x. If set to READ implicit read-locks are acquired. > Acquiring a read-lock on x thus allways results in implicit read-locks > on all associated objects. >=20 > Using uncommited reads in combination with LockAssociation=3DREAD will = > reduce Locking related problems to a minimum. >=20 > But as I said before: your problem is NOT related to locking. >=20 >=20 > >=20 > > Thanks in advance. > >=20 > > Ricardo Arguello (an ex-Castor refugee) >=20 >=20 > I'll work hard to ensure you won't become an OJB refugee ;-) >=20 >=20 > cu, >=20 > Thomas >=20 >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: Thomas M. <tho...@ho...> - 2002-01-30 20:47:32
|
Hi Ricardo, sorry for the trouble OJB is causing for you. We'll try to get a solution for this soon. Ricardo Arguello wrote: > Hello, > > As I said before, I'm getting a > TransactionInProgressException when I use OJB in > Client/Server mode. > > I tried changing the log to DEBUG, bit it imposibe for me > to distinguish any of the errors, there is a LOT of DEBUG > messages, of the following style: > Yup, sometimes it's hard to know which part of the system might write the relevant log infos... > > [ojb.broker.server.RequestProcessor] DEBUG: OJB > RequestProcessor 2 waiting... > [ojb.broker.server.RequestProcessor] DEBUG: OJB > RequestProcessor 7 working... > [ojb.broker.server.RequestProcessor] DEBUG: dispatching [24, > [ojb.broker.server.RequestProcessor] DEBUG: -1, > [ojb.broker.server.RequestProcessor] DEBUG: class > charlie.ojb.EmpleadoOJB, > [ojb.broker.server.RequestProcessor] DEBUG: null] > [ojb.broker.server.BrokerPool] DEBUG: getFreeBrokerId: 1, > remaining: [1, 1, 1, 1 > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 3, > 1, 1, 1, 1, 1, 1, 3, > 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1 > , 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 5, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 1, > 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 8, > 1, 1, 1, 9, 1, 1, 9, 1 > , 1, 1, 1, 1, 1, 0, 1, 9, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, > 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1 > , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] > > > Awful, right? Yes that's awful to read. But it is also a clear indicator that there must be a bug in the BrokerPool. It should contain exactly ten brokers numbered from 0 - 9. As the list you see contains a lot of "1" entries you are served with the same broker instance for multiple transactions. This is definitely a severe bug. I will start working on it asap and hope to have a fix by the weekend. > > I cannot find the errors I metioned in my previous > message... But my application stil acts the same: Two > persons can't even login at the same time, one of them gets > a stack trace... > I assume that it is all related to the above error ! > I was reading the Locking document, and I tried to add a > isolation="read-uncommitted" to all my class definitions in > the repository.xml file, but tha doesn't help either. This is definitely a locking problem. OJB uses read-uncommited by default already. In the case of locking problems you would get a ODMG LockNotGrantedException! > How > should I declare my lockings? In the XML file, in my code > (you say the ODMG doesnt dictate a way to that). > Locking is declared in the repository only. ODMG specifies no API for setting locklevels. > > Please clarify this to me? Do I need to do C/S to use OJB > in a web application? Hmm. I know of people who are using OJB in singlevm mode in Web apps. As long as the commit phase of ODMG transactions is relatively short there won't be much problems. I'm intending to have brokerpool for the singlevm mode too. then it will be totally safe to use the singlevm mode which is much faster !!! > Wouldn't a "OJB Helper" with a single Database instance > (singleton) be enough? > Yes that should be sufficient. > If that's the case, how could I implement that? Hmm, I'm not quite sure what you want to implement exactly? > Is OJB thread safe? Yes >How can I use OJB with Tomcat + Struts? A colleague of mine used Struts and the OJB ODMG api sucessfully. He defined special STruts actions that used ODMG transactions to do the persistence work. It's pretty straightforward. If you are interested I might post you sample code for this. > How can I assure that 2 transactions can READ at the same > time, without locking? > Currently the OJB ODMG implementation relies on pessimistic locking. There is currently no optimistic locking support. (will be there in 1.0) But if you use "uncommitted-read" there should be no locking problems. You can do even more do avoid lock conflicts through WRITE operations. In OJB.properties you'll find an entry LockAssociations set this to READ. The LockAssociations entry defines the behaviour for the OJB implicit locking feature. If set to WRITE (default) acquiring a write- lock on a given object x implies write locks on all objects associated to x. If set to READ implicit read-locks are acquired. Acquiring a read-lock on x thus allways results in implicit read-locks on all associated objects. Using uncommited reads in combination with LockAssociation=READ will reduce Locking related problems to a minimum. But as I said before: your problem is NOT related to locking. > > Thanks in advance. > > Ricardo Arguello (an ex-Castor refugee) I'll work hard to ensure you won't become an OJB refugee ;-) cu, Thomas |
From: Thomas M. <tho...@ho...> - 2002-01-30 20:47:31
|
Hi Eric, Eric Bieschke wrote: > I am currently subscribed to the Objectbridge-developers mailing list. I > often want to search through the archives of this list so I can check and > see if my question/comment has already been addressed. To the best of my > knowledge, the archives are only available here: > > http://www.geocrawler.com/lists/3/SourceForge/7392/0/ > there is also a SF version of this at http://sourceforge.net/mailarchive/forum.php?forum_id=4880 > I also monitor the forums hosted on SourceForge here: > > https://sourceforge.net/forum/?group_id=13647 > > For the life of me I cannot deduce how to search through these archives. Am > I missing this functionality? If not, what action can I take to make this > available? Hmm. AFAIK Geocrawler and SF don't support this directly. I believe you can use Google to search only through the pages of a certain site. If this does not work maybe it's a good idea to post a feature request to SorceForge! HTH, Thomas > > Thank you for your time, > > - Eric Bieschke > EBi...@Sa... > > > > > > > > |
From: Mahler T. <tho...@it...> - 2002-01-30 10:28:14
|
Hi Craig, =20 -----Urspr=FCngliche Nachricht----- Von: Craig Shearer [mailto:cra...@he...] Gesendet: Mittwoch, 30. Januar 2002 02:47 An: obj...@li... Betreff: [OJB-developers] Documentation on "using proxy classes" = out-of-date Hi =20 I've been looking into ObjectBridge and done some experiments, and I'm = now on to trying out using proxies. I followed the instructions in the obj-0.7.310\build\doc\tutorial3.html but they seem to be out-of-date.=20 =20 I will correct the documentation accordingly! thanks for your = observance to details.=20 =20 In particular, the VirtualProxy constructors have changed - there is no longer a public VirtualProxy(ojb.broker.Identity, PersistenceBroker) - = this seems to have been replaced by public = VirtualProxy(ojb.broker.Identity). In addition to this, to get the code to work, I had to implement the = public VirtualProxy(InvocationHandler handler) constructor too.=20 =20 Did you have at the dynamic proxy stuff? they are much simpler to use = than manually coded proxies, as they need just be declared in the = repository. Manually coded proxies are useful only for VERY special purposes.=20 =20 Is this correct? And what happened to tutorial3? It seems to have disappeared.=20 =20 Hmm: In my browser it is loaded without problems: http://objectbridge.sourceforge.net/tutorial3.html <http://objectbridge.sourceforge.net/tutorial3.html> =20 =20 HTH, Thomas =20 Craig Shearer Chief Architect Dyosoft Systems Limited http://www.dyosoft.com <http://www.dyosoft.com/>=20 cra...@dy... <mailto:cra...@dy...>=20 Phone: (Mobile) 025 936 334=20 =20 |
From: Craig S. <cra...@he...> - 2002-01-30 01:44:41
|
Hi I've been looking into ObjectBridge and done some experiments, and I'm now on to trying out using proxies. I followed the instructions in the obj-0.7.310\build\doc\tutorial3.html but they seem to be out-of-date. In particular, the VirtualProxy constructors have changed - there is no longer a public VirtualProxy(ojb.broker.Identity, PersistenceBroker) - this seems to have been replaced by public VirtualProxy(ojb.broker.Identity). In addition to this, to get the code to work, I had to implement the public VirtualProxy(InvocationHandler handler) constructor too. Is this correct? And what happened to tutorial3? It seems to have disappeared. Craig Shearer Chief Architect Dyosoft Systems Limited http://www.dyosoft.com cra...@dy... Phone: (Mobile) 025 936 334 |
From: Mahler T. <tho...@it...> - 2002-01-25 14:09:37
|
Hi again Darren, You are totally right. The PersistenceBrokerException way of wrapping = source exception is not very good right now.=20 I'll put it on the todo list ... thanks for your hint, Thomas > -----Urspr=FCngliche Nachricht----- > Von: Darren Syzling [mailto:Dar...@cw...] > Gesendet: Freitag, 25. Januar 2002 14:56 > An: obj...@li... > Betreff: [OJB-developers] PersistenceBrokerException >=20 >=20 > Hi, >=20 > I've just generated a test case in our own code which lead to=20 > a failure in > generating a new sequence id. No problem with this except I=20 > seem to be losing > exception information as the exception is thrown from=20 > ClassDescriptor out > through the PersistenceBroker. >=20 > PersistenceBrokerException seems to store the exception=20 > reason in a field calls > 'msg' along with a reference to the nested exception. =20 > However calling > getMessage on a base class of PersistenceBrokerException does=20 > not return this > error - since it will use the Throwable implementation. Now=20 > this may or may not > be what was intended - this does however cause problems where > PersistenceBrokerExceptions are caught and translated,=20 > especially where we see > code such as: >=20 > catch(Throwable e) > { > throw new MyException(e.getMessage()); > } >=20 > This type of translation actually occurs within the sequence=20 > generation stack: >=20 > ClassDescriptor.getKeyValues() throws PersistenceBrokerException > Identify() catches Throwable and translates to=20 > ClassNotPersistenceCapable using > t.getMessage. >=20 > In this scenario the PersistenceBrokerException which is=20 > thrown out of the > broker.store does not contain the original error details in=20 > the message. >=20 > PersistenceBrokerException also doesn't provide a mechanism=20 > for retrieving the > 'source' exception. Kind of leads me to think it was an=20 > initial implementation > or I'm missing the intent. >=20 >=20 >=20 > Regards > Darren >=20 >=20 >=20 > ************************************************************** > ************************************************************** > ************************** > This e-mail has been prepared using information believed by=20 > the author to be > reliable and accurate, but Thales Information Systems Finance=20 > makes no > warranty as to accuracy or completeness. In particular=20 > Thales Information > Systems Finance does not accept responsibility for =20 > changes made to this > e-mail after it was sent. Any opinions expressed in this=20 > document are those of > the author and do not necessarily reflect the opinions of=20 > the company or its > affiliates. They may be subject to change without notice. > This e-mail, its content and any files transmitted with=20 > it are intended > solely for the addressee(s) and may be legally =20 > privileged and/or > confidential. Access by any other party is unauthorised=20 > without the express > written permission of the sender. If you have received this=20 > e-mail in error you > may not copy or use the contents, attachments or=20 > information in any way. > Please destroy it and contact the sender via the Thales=20 > Information Systems > Finance switchboard in London at +44 (0) 20 7650 0100 or via=20 > e-mail return. > This message and any attachments have been scanned > for viruses prior to leaving the originators network. The=20 > originator does not > guarantee the security of this message and will not be=20 > responsible for any > damages arising from any alteration of this message by a=20 > third party or as a > result of any virus being passed on. > ************************************************************** > ************************************************************** > *************************** >=20 >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: Darren S. <Dar...@cw...> - 2002-01-25 14:01:27
|
Hi, I've just generated a test case in our own code which lead to a failure in generating a new sequence id. No problem with this except I seem to be losing exception information as the exception is thrown from ClassDescriptor out through the PersistenceBroker. PersistenceBrokerException seems to store the exception reason in a field calls 'msg' along with a reference to the nested exception. However calling getMessage on a base class of PersistenceBrokerException does not return this error - since it will use the Throwable implementation. Now this may or may not be what was intended - this does however cause problems where PersistenceBrokerExceptions are caught and translated, especially where we see code such as: catch(Throwable e) { throw new MyException(e.getMessage()); } This type of translation actually occurs within the sequence generation stack: ClassDescriptor.getKeyValues() throws PersistenceBrokerException Identify() catches Throwable and translates to ClassNotPersistenceCapable using t.getMessage. In this scenario the PersistenceBrokerException which is thrown out of the broker.store does not contain the original error details in the message. PersistenceBrokerException also doesn't provide a mechanism for retrieving the 'source' exception. Kind of leads me to think it was an initial implementation or I'm missing the intent. Regards Darren ****************************************************************************************************************************************************** This e-mail has been prepared using information believed by the author to be reliable and accurate, but Thales Information Systems Finance makes no warranty as to accuracy or completeness. In particular Thales Information Systems Finance does not accept responsibility for changes made to this e-mail after it was sent. Any opinions expressed in this document are those of the author and do not necessarily reflect the opinions of the company or its affiliates. They may be subject to change without notice. This e-mail, its content and any files transmitted with it are intended solely for the addressee(s) and may be legally privileged and/or confidential. Access by any other party is unauthorised without the express written permission of the sender. If you have received this e-mail in error you may not copy or use the contents, attachments or information in any way. Please destroy it and contact the sender via the Thales Information Systems Finance switchboard in London at +44 (0) 20 7650 0100 or via e-mail return. This message and any attachments have been scanned for viruses prior to leaving the originators network. The originator does not guarantee the security of this message and will not be responsible for any damages arising from any alteration of this message by a third party or as a result of any virus being passed on. ******************************************************************************************************************************************************* |
From: Mahler T. <tho...@it...> - 2002-01-25 11:27:00
|
Oops, I thought I fixed this already. Must be a problem with my local CVS = server. I will fix it in the next release ! thanks, Thomas > -----Urspr=FCngliche Nachricht----- > Von: Darren Syzling [mailto:Dar...@cw...] > Gesendet: Freitag, 25. Januar 2002 11:36 > An: obj...@li... > Betreff: [OJB-developers] RsIterator.releaseDbResources >=20 >=20 > Hi, >=20 > We're using Object Bridge 0.7.310 with SQL Server 7.0 (MS SQL=20 > Server JDBC > drivers) and when indirectly using anything which uses=20 > RsIterator the drivers > are complaining that the driver object has been closed. =20 > Here's the stack trace: >=20 > java.sql.SQLException: [Microsoft][SQLServer JDBC=20 > Driver]Object has been closed. > at=20 > com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) > at=20 > com.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown > Source) > at=20 > com.microsoft.jdbc.base.BaseResultSet.getStatement(Unknown Source) > at > ojb.broker.accesslayer.RsIterator.releaseDbResources(RsIterato > r.java:304) > at = ojb.broker.accesslayer.RsIterator.hasNext(RsIterator.java:109) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:808) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:878) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:943) > at > ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery > (PersistenceBrokerImpl.java:933) >=20 > The code in RsIterator.releaseDbResources looks like this: >=20 > try > { > m_rs.close(); > Statement stmt =3D m_rs.getStatement(); > if (stmt !=3D null) > { > stmt.close(); > } > m_rs =3D null; > } >=20 > It appears that the result set is closed before returning the=20 > statement that > produced it, should this be: >=20 > Statement stmt =3D m_rs.getStatement(); > m_rs.close(); > if (stmt !=3D null) > stmt.close(); > ... >=20 >=20 > Regards > Darren >=20 >=20 >=20 > ************************************************************** > ************************************************************** > ************************** > This e-mail has been prepared using information believed by=20 > the author to be > reliable and accurate, but Thales Information Systems Finance=20 > makes no > warranty as to accuracy or completeness. In particular=20 > Thales Information > Systems Finance does not accept responsibility for =20 > changes made to this > e-mail after it was sent. Any opinions expressed in this=20 > document are those of > the author and do not necessarily reflect the opinions of=20 > the company or its > affiliates. They may be subject to change without notice. > This e-mail, its content and any files transmitted with=20 > it are intended > solely for the addressee(s) and may be legally =20 > privileged and/or > confidential. Access by any other party is unauthorised=20 > without the express > written permission of the sender. If you have received this=20 > e-mail in error you > may not copy or use the contents, attachments or=20 > information in any way. > Please destroy it and contact the sender via the Thales=20 > Information Systems > Finance switchboard in London at +44 (0) 20 7650 0100 or via=20 > e-mail return. > This message and any attachments have been scanned > for viruses prior to leaving the originators network. The=20 > originator does not > guarantee the security of this message and will not be=20 > responsible for any > damages arising from any alteration of this message by a=20 > third party or as a > result of any virus being passed on. > ************************************************************** > ************************************************************** > *************************** >=20 >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: Darren S. <Dar...@cw...> - 2002-01-25 10:41:41
|
Hi, We're using Object Bridge 0.7.310 with SQL Server 7.0 (MS SQL Server JDBC drivers) and when indirectly using anything which uses RsIterator the drivers are complaining that the driver object has been closed. Here's the stack trace: java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Object has been closed. at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) at com.microsoft.jdbc.base.BaseResultSet.validateClosedState(Unknown Source) at com.microsoft.jdbc.base.BaseResultSet.getStatement(Unknown Source) at ojb.broker.accesslayer.RsIterator.releaseDbResources(RsIterator.java:304) at ojb.broker.accesslayer.RsIterator.hasNext(RsIterator.java:109) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:808) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:878) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:943) at ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl.java:933) The code in RsIterator.releaseDbResources looks like this: try { m_rs.close(); Statement stmt = m_rs.getStatement(); if (stmt != null) { stmt.close(); } m_rs = null; } It appears that the result set is closed before returning the statement that produced it, should this be: Statement stmt = m_rs.getStatement(); m_rs.close(); if (stmt != null) stmt.close(); ... Regards Darren ****************************************************************************************************************************************************** This e-mail has been prepared using information believed by the author to be reliable and accurate, but Thales Information Systems Finance makes no warranty as to accuracy or completeness. In particular Thales Information Systems Finance does not accept responsibility for changes made to this e-mail after it was sent. Any opinions expressed in this document are those of the author and do not necessarily reflect the opinions of the company or its affiliates. They may be subject to change without notice. This e-mail, its content and any files transmitted with it are intended solely for the addressee(s) and may be legally privileged and/or confidential. Access by any other party is unauthorised without the express written permission of the sender. If you have received this e-mail in error you may not copy or use the contents, attachments or information in any way. Please destroy it and contact the sender via the Thales Information Systems Finance switchboard in London at +44 (0) 20 7650 0100 or via e-mail return. This message and any attachments have been scanned for viruses prior to leaving the originators network. The originator does not guarantee the security of this message and will not be responsible for any damages arising from any alteration of this message by a third party or as a result of any virus being passed on. ******************************************************************************************************************************************************* |
From: Mahler T. <tho...@it...> - 2002-01-25 10:13:18
|
Hi Daniel, > Hi Thomas. > > I have some questions about PersistenceBrokerImpl, as you > know I'm working on JTA support for OJB, I have started with > the PersistenceBroker interface, and then if everything goes > fine will take a look at the ODMG interface. > > I'm basically working with four methods, they are > abortTransaction(), beginTransaction(), commitTransaction() > and checkPoint(). Last two seems to be very similar, could > you clarify me what checkPoint() is used for and why it > should commit a transaction? In PersistenceBrokerImpl the difference is as follows: checkPoint() simply applies commit() to all Jdbc Connections the broker is holding. commitTransaction does the same but in addition it sets conn.setAutoCommit(true) for each Jdbc Connection. I'm not sure if the checkPoint Method is really needed. It is called in client server mode for store operations, but I'm not sure if it is really required. I guess it's OK if you focus on commitTransaction(). HTH, Thomas > > thanks in advance. > > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > |
From: Daniel Fernn. E. <dfe...@wn...> - 2002-01-24 20:21:46
|
Hi Thomas. I have some questions about PersistenceBrokerImpl, as you know I'm working on JTA support for OJB, I have started with the PersistenceBroker interface, and then if everything goes fine will take a look at the ODMG interface. I'm basically working with four methods, they are abortTransaction(), beginTransaction(), commitTransaction() and checkPoint(). Last two seems to be very similar, could you clarify me what checkPoint() is used for and why it should commit a transaction? thanks in advance. |
From: <ri...@ya...> - 2002-01-22 19:40:23
|
Hi, How do you map a float value to a MySql table field? The OJB documentation says that you should map float values to a REAL = column in the database, but MySql doesn't have that sort of data type. First, I defined the MySql field as FLOAT(4,2). Then I tried to map the float value to a REAL column, in the mapping.xml = file, but OJB expects a double value: [ojb.broker.accesslayer.RsIterator] ERROR: null java.lang.Double at = ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectFrom(RowReaderDefau= ltI mpl.java:77) ... I've tried to map it to a FLOAT column in the mapping.xml file, but I = receive the same exception: OJB is expecting a double. For all these changes, my database field was defined as FLOAT(4,2). = Should I change this? Has anybody mapped a float to a MySql database? Thanks in advance. Ricardo Arguello |
From: Jakob B. <jbr...@ho...> - 2002-01-22 15:43:32
|
hi, here's a solution for todo item 88 (QueryBySQL). sample code: ... sql = "select * from tabPerson where name like '%er' "; query = new QueryBySQL(Person.class, sql); broker.getCollectionByQuery(query); ... btw i think the query interface should be reworked the methods getCriteria() and isDistinct() could be moved to a subinterface QueryByCriteria (name already exists i know) and the method getExampleObject() to another subinterface. hth jakob |
From: Darren S. <dsy...@ci...> - 2002-01-21 19:51:26
|
Thomas, > These "Smart Update" feature has been kicked out a long time ago. May be > it was still mentioned in the performance comparison. (I kicked out this > documents as it is over a year old and totally out of date). You're right I found no reference to the EJB comparison in the latest distribution. > Now OJB is working with prepared statements and uses a caching mechanism > for these statements. > This setup brings an enormous performance gain for most application > scenarios against most RDBMS. I suspected this may be the case but wanted to hear you say it :-) > That's why I dropped this feature. > My performance tests showed that using the cached prepared statement > instead of dynamic "smart updates" has a much better performance. Good, that's the kind of anecdotal evidence I was looking for. If prepared statements negate the performance improvement made by smart updates then for the kind of work I'll be doing this should be fine. If I find any problems I'll report back... Darren |
From: Thomas M. <tho...@ho...> - 2002-01-21 06:08:25
|
Hi Darren, Darren Syzling wrote: > I seem to remember testing a version of Object Bridge 0.7.235 that performed > smart (or tuned) updates - only updating columns that had been modified. > The documentation which came with this version mentioned this feature in a > performance comparison with EJB. > These "Smart Update" feature has been kicked out a long time ago. May be it was still mentioned in the performance comparison. (I kicked out this documents as it is over a year old and totally out of date). At the time of "smart updates" OJB did even use prepared statements. We used dynamically generated SQL that was generated for each update. No parameter binding. No caching of prepared statement. Now OJB is working with prepared statements and uses a caching mechanism for these statements. This setup brings an enormous performance gain for most application scenarios against most RDBMS. Of course it would even be better to still have a smart update mechanism. but this would require to cache much MUCH more statements. For N columns there are (if I remember correctly) (2^N) - 1 possible. For a table with 10 coulums we had to cache more then 1000 statement ! That's why I dropped this feature. My performance tests showed that using the cached prepared statement instead of dynamic "smart updates" has a much better performance. HTH, Thomas |
From: Darren S. <dsy...@ci...> - 2002-01-20 17:00:11
|
I seem to remember testing a version of Object Bridge 0.7.235 that performed smart (or tuned) updates - only updating columns that had been modified. The documentation which came with this version mentioned this feature in a performance comparison with EJB. I'm writing some test code with the 0.7.310 and I can't see any reference to smart updates. When I turn on SQL logging I only see a prepared statement that updates all columns. Have I missed anything ? Thanks Darren |
From: Thomas M. <tho...@ho...> - 2002-01-18 20:30:31
|
Hi Bertrand, thanks for your code! I will integrate it into the next release. I'm currently working on compatibility issues wrt. MS Access. Once I got OJB running against ACcess I will work on your code. Will take some more days. syl...@be... wrote: > Hi Thomas > > Here is thelog4jLoggerImpl I told you about. > > I had to change a few things in other classes to > make it work. > > The main problem was that with log4j you have to > give a name the logger (log4j Category) when you > create it. > You cannot create a category then do a setname() > afterwards. > So I changed the Logger interface to remove the > setname() method. > Change PoorMansLoggerImpl so that its > constructor did get the name directly and > removed the setname() method. > I then had to change LoggerFactory to call the > constructor with the name as argument. > > I also found interesting to be able to specify a > configuration file for log4j so I changed the > PersistenceBrokerFactoryConfiguration to read > the LoggerConfigFile property. > Yes that's good, as many people will like to reuse their existing Log4J config files. > To help you found the changes I started them > with a //bmi comment. > > Here is a zip file with > Logger.java > PoorMansLoggerImpl.java > LoggerFactory > Log4jLoggerImpl.java > PersistenceBrokerFactoryConfiguration > And two sample configuration file > OJB.properties > Log4j.properties > and > log4j.jar just in case > thanks for your careful description. will help me to things integrated smoothly! > Greetings > > Bertrand > cu, Thomas |
From: <syl...@be...> - 2002-01-18 19:04:28
|
The following section of this message contains a file attachment prepared for transmission using the Internet MIME message format. If you are using Pegasus Mail, or any another MIME-compliant system, you should be able to save it or view it from within your mailer. If you cannot, please ask your system administrator for assistance. ---- File information ----------- File: log4jLoggerImpl.zip Date: 18 Jan 2002, 19:58 Size: 156244 bytes. Type: ZIP-archive |
From: <syl...@be...> - 2002-01-18 19:04:18
|
Hi Thomas Here is thelog4jLoggerImpl I told you about. I had to change a few things in other classes to make it work. The main problem was that with log4j you have to give a name the logger (log4j Category) when you create it. You cannot create a category then do a setname() afterwards. So I changed the Logger interface to remove the setname() method. Change PoorMansLoggerImpl so that its constructor did get the name directly and removed the setname() method. I then had to change LoggerFactory to call the constructor with the name as argument. I also found interesting to be able to specify a configuration file for log4j so I changed the PersistenceBrokerFactoryConfiguration to read the LoggerConfigFile property. To help you found the changes I started them with a //bmi comment. Here is a zip file with Logger.java PoorMansLoggerImpl.java LoggerFactory Log4jLoggerImpl.java PersistenceBrokerFactoryConfiguration And two sample configuration file OJB.properties Log4j.properties and log4j.jar just in case Greetings Bertrand |
From: Thomas M. <tho...@ho...> - 2002-01-18 18:31:53
|
Hi Michael, please excuse me for getting back to you so late. I have been quite busy and your mail got lost in my inbox... Michael Nowotny wrote: > Hi Thomas! > > Is there a way to let OJB create and remove tables automatically. In my > opinion such a feature could come in quite handy while developing your app. That's a good idea. I have been dreaming of full forward/reverse engineering support in OJB. There should be support for: 1. automatic generation (and maybe also execution) of SQL DDL (and a repository.xml) from a object model. 2. it should be possible to reverse-engineer database table to persistent classes and a repository.xml. 3. It should be possible to write a repository.xml and have both Java classes and DB tables generated. 4. convienant support to build mapping from existing Object Model on existing tables (maybe similar to the TOPLink mapping workbench). Maybe XSL transformation is a good vehicle for 1.-3. ?! > JBoss has such an option. An XSLT Stylesheet that transforms > the repository XML into sql statements could look like this: > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:output method="text" omit-xml-declaration="yes" indent="yes"/> > > <xsl:template match="/"> > <xsl:for-each select="MappingRepository/ClassDescriptor"> > <!-- generate sql drop table statement--> > <xsl:text>drop table </xsl:text><xsl:value-of > select="table.name"/><xsl:text>; > </xsl:text> > <!-- generate sql create table statement--> > <xsl:text>create table </xsl:text><xsl:value-of > select="table.name"/><xsl:text> ( > </xsl:text> > <xsl:for-each select="FieldDescriptor"> > <xsl:value-of select="column.name"/> > <xsl:text> </xsl:text> > <xsl:value-of select="jdbc_type"/> > <xsl:if test="PrimaryKey='true'"> > <xsl:text> NOT NULL PRIMARY KEY</xsl:text> > </xsl:if> > <xsl:text> > </xsl:text> > </xsl:for-each> > <xsl:text>); > > </xsl:text> > </xsl:for-each> > </xsl:template> > </xsl:stylesheet> > > What still remains to be done is inserting switches that indicate whether > you want automatic table creation/removal enabled or not. It might be > possible to change > the repository.dtd accordingly. that's a cool approach ! I tried it and the output looks quite promising already. But there are some caveats: 1. Multiple classes maybe mapped on one and the same table. They may even use different columns ! 2. OJB allows to have compound primary key which are not handled properly by the above xsl stylesheet. 3. The current DTD does not contain size information (e.g. only VARCHAR but not VARCHAR(255) !) having automatic creation configurable is a good idea! In some production evironment it won't be viable to have tables changed dynamically ! > Another thing I don't know is whether jdbc types are automatically mapped to > sql types by the jdbc driver. This is another caveat. It would be possible to deduce the type info for a given JDBC ResultSet column from the respective MetaData object. But to be compatible with a large number of RDBMS OJB relies on an explicit type declaration in each FieldDescriptor. (Thus we can e.g. have a VARCHAR in the DB, but a byte[] in the Java Object) Maybe it's a good idea to have the type info optional, as it is sufficient for most cases. Feel free to work on this and contribute some code if you like! You have so many creative ideas, why not let some of them come OJB reality ;-) cu, Thomas ps.: have you been digging into the GC idea further ? |
From: Thomas M. <tho...@ho...> - 2002-01-17 17:01:10
|
Hi Bertrand, syl...@be... wrote: > Thomas, > > I've started to implement a log4jLoggerImpl. > Great! I guess you came over my comment in OJB.properties where I invited everybody to write such a Log4J based logger. > It compiles ok and seems to work. After some more testing I will > post it to you > Fine! I hope it was not too difficult as I tried to make the Logger interface Log4j friendly. thanks again, Thomas > > Best regards > > Bertrand > > > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > > > > |
From: <syl...@be...> - 2002-01-17 12:21:32
|
Thomas, I've started to implement a log4jLoggerImpl. It compiles ok and seems to work. After some more testing I will post it to you Best regards Bertrand |
From: Michael N. <mic...@gm...> - 2002-01-15 21:23:10
|
Hi Thomas! Is there a way to let OJB create and remove tables automatically. In my opinion such a feature could come in quite handy while developing your app. JBoss has such an option. An XSLT Stylesheet that transforms the repository XML into sql statements could look like this: <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text" omit-xml-declaration="yes" indent="yes"/> <xsl:template match="/"> <xsl:for-each select="MappingRepository/ClassDescriptor"> <!-- generate sql drop table statement--> <xsl:text>drop table </xsl:text><xsl:value-of select="table.name"/><xsl:text>; </xsl:text> <!-- generate sql create table statement--> <xsl:text>create table </xsl:text><xsl:value-of select="table.name"/><xsl:text> ( </xsl:text> <xsl:for-each select="FieldDescriptor"> <xsl:value-of select="column.name"/> <xsl:text> </xsl:text> <xsl:value-of select="jdbc_type"/> <xsl:if test="PrimaryKey='true'"> <xsl:text> NOT NULL PRIMARY KEY</xsl:text> </xsl:if> <xsl:text> </xsl:text> </xsl:for-each> <xsl:text>); </xsl:text> </xsl:for-each> </xsl:template> </xsl:stylesheet> What still remains to be done is inserting switches that indicate whether you want automatic table creation/removal enabled or not. It might be possible to change the repository.dtd accordingly. Another thing I don't know is whether jdbc types are automatically mapped to sql types by the jdbc driver. Greetings, Michael ----- Original Message ----- From: "Mahler Thomas" <tho...@it...> To: "'Michael Nowotny'" <mic...@gm...>; "ojb" <obj...@li...> Sent: Tuesday, January 15, 2002 10:29 AM Subject: AW: [OJB-developers] Re: Named Root Objects > Hi Michael, > > > There will be a lot of people using OJB who do not use named roots. > Just imagine their faces when the GC starts and deletes all their objects > because they where unreferenced >:-() !!! > > Thus Having the GC as a separate tool is a good idea, not to say a MUST! > > Implementing a GC that will reclaim everything that can not be reached from > a named root will not be difficult. > The algorithm you describe is a simple "mark and sweep" algorithm. Would be > fun to implement such a thing! > > cheers, > > Thomas > > > > > > Hi Thomas! > > > > I've been thinking about the GC process over the last few days. > > > > > Currently there is no GC implemented. > > > IMHO it will be VERY difficult to have a real GC as it > > would be possible > > > with an OODBMS. > > > It will be very difficult to decide if objects can safely > > be deleted. > > > > > > BUT: we have been thinking of changing the semantics of > > DList.remove() > > > an similar methods as name roots unbind so that removed objects are > > > deleted from the DB. > > > > A first step towards true persistence by reachability could > > be to offer > > offline GC. This way you don't have the to deal with objects which not > > reachable from any named root object any more but are still > > referenced under > > another transaction that has not yet committed. The algorithm > > could look > > like this: > > > > 1. Make a list of all objects stored in the database > > 2. from every named root object traverse the object graph and mark any > > object you come across as being persistent > > 3. delete all the objects from the database which are > > currently not marked > > as persistent. > > > > The algorithm can be implemented using recursion. In order to avoid > > indefinite loops caused by cyclic references, the algorithm > > has to check > > whether an object under investigation is already marked. > > > > Another advantage is that people who do not want seamless > > persistence the > > "Java Way" but instead want to have a more basic level > > control over their > > data still have the option not to execute the garbage collector. > > > > What do you think about it? > > > > > > Greetings Michael > > ----- Original Message ----- > > From: "Thomas Mahler" <tho...@ho...> > > To: "Michael Nowotny" <mic...@gm...>; "ojb" > > <obj...@li...> > > Sent: Wednesday, January 09, 2002 6:51 PM > > Subject: Re: Named Root Objects > > > > > > > Hi again, > > > > > > > > > Michael Nowotny wrote: > > > > > > > Hi Thomas! > > > > > > > > Thanks for the illustration. Binding collections works > > fine for me now! > > > > The reason why my earlier attempt failed was that I was > > still using > > > > InstantDB.It seems that some transactions got only > > halfway commited due > > to > > > > program termination following db.close(). Now I'm using > > Hypersonic and > > > > everything works. > > > > > > > > > > Fine ! > > > > > > > > > > During the course of setting up a test procedure I came > > across some > > strange > > > > behaviour. The following code snipped throws an > > ObjectNameNotBoundException. > > > > > > > > // fails: > > > > tx = odmg.newTransaction(); > > > > tx.begin(); > > > > db.bind(odmg.newDList(), "MyList"); > > > > db.unbind("MyList"); > > > > db.bind(odmg.newDList(), "MyList"); > > > > // DList list = (DList)db.lookup("MyList"); > > > > tx.commit(); > > > > > > > > tx = odmg.newTransaction(); > > > > tx.begin(); > > > > DList newList = (DList)db.lookup("MyList"); > > > > tx.commit(); > > > > > > > > Binding the same name twice within the same transaction > > seems to cause > > an > > > > error. > > > > > > > > > Oops, This is a bug. I'll add it to my todo list! > > > > > > > > > This is not very important though because usually one wouldn't want > > > > to bind an object to a some name and thereafter unbinding > > that name > > withing > > > > the same transaction. > > > > > > > > Another question arose when I had a look at the contents > > of my database. > > If > > > > I add content to my list which is a named root object > > this content gets > > > > persistent as well. That's part of persistence by > > reachability. But when > > I > > > > unbind the root object and the content is therefore no > > longer reachable, > > it > > > > doesn't get removed from the database but is still > > present. Is there any > > way > > > > of performing some kind of garbage collection? > > > > > > > > > > > > > > > > Currently there is no GC implemented. > > > IMHO it will be VERY difficult to have a real GC as it > > would be possible > > > with an OODBMS. > > > It will be very difficult to decide if objects can safely > > be deleted. > > > > > > BUT: we have been thinking of changing the semantics of > > DList.remove() > > > an similar methods as name roots unbind so that removed objects are > > > deleted from the DB. > > > > > > Any ideas? > > > > > > -- Thomas > > > > > > > > > > > > > > > > Keep up the good work! > > > > > > > > Thanks, Michael > > > > > > > > ----- Original Message ----- > > > > From: "Thomas Mahler" <tho...@ho...> > > > > To: "Michael Nowotny" <mic...@gm...>; "ojb" > > > > <obj...@li...> > > > > Sent: Tuesday, January 08, 2002 8:20 PM > > > > Subject: Re: Named Root Objects > > > > > > > > > > > > > > > >>Hi Michael, > > > >> > > > >>please see the attached Java class. > > > >> > > > >>You can replace the original version of > > test.ojb.odmg.OdmgExamples with > > > >>this new version to have it executed with the OJB JUnit tests. > > > >> > > > >>There is a new testMethod testNrmAndDlists that tests > > your scenario. > > > >>Works great! > > > >> > > > >>HTH, > > > >> > > > >>Thomas > > > >> > > > >>Michael Nowotny wrote: > > > >> > > > >> > > > >>>Hi Thomas! > > > >>> > > > >>>Just found your OJB project on sourceforge. I think it's > > great to have > > > >>> > > > > an > > > > > > > >>>open source ODMG implementation around. > > > >>>Now I've got a question concerning the ODMG implemetation. > > > >>>Is it possible to use a DList for example as a named root object. > > > >>> > > > > Binding > > > > > > > >>>that object to a name works but looking it up again causes an > > > >>>IllegalArgumentException. > > > >>> > > > >>>Have you ever tried to bind a Collection. If so, I would > > be grateful if > > > >>> > > > > you > > > > > > > >>>could drop me some lines of source code. > > > >>> > > > >>>Thanks Michael > > > >>> > > > >>> > > > >>> > > > >>> > > > >>> > > > >>> > > > >> > > > >> > > > > > > > > > > > > > > > > -------------------------------------------------------------- > > ------------ > > -- > > > > ---- > > > > > > > > > > > > > > > >>package test.ojb.odmg; > > > >> > > > >> > > > >>import junit.framework.TestCase; > > > >>import ojb.broker.Identity; > > > >>import ojb.broker.PersistenceBroker; > > > >>import ojb.broker.PersistenceBrokerFactory; > > > >>import ojb.broker.cache.ObjectCacheFactory; > > > >>import ojb.odmg.OJB; > > > >>import ojb.odmg.states.ModificationState; > > > >>import ojb.odmg.states.StateNewClean; > > > >>import ojb.odmg.states.StateNewDirty; > > > >>import org.odmg.*; > > > >> > > > >>import java.util.List; > > > >> > > > >>/** Demo Application that shows basic concepts for > > Applications using > > the > > > >> > > > > OJB ODMG > > > > > > > >> * implementation as an transactional object server. > > > >> */ > > > >>public class OdmgExamples extends TestCase > > > >>{ > > > >> public static void main(String[] args) > > > >> { > > > >> String[] arr = {CLASS.getName()}; > > > >> junit.textui.TestRunner.main(arr); > > > >> } > > > >> > > > >> private static Class CLASS = OdmgExamples.class; > > > >> private String databaseName; > > > >> > > > >> /** > > > >> * Insert the method's description here. > > > >> * Creation date: (24.12.2000 00:33:40) > > > >> */ > > > >> public OdmgExamples(String name) > > > >> { > > > >> super(name); > > > >> } > > > >> > > > >> /** > > > >> * Insert the method's description here. > > > >> * Creation date: (06.12.2000 21:58:53) > > > >> */ > > > >> public void setUp() > > > >> { > > > >> databaseName = > > > >> > > > > > > PersistenceBrokerFactory.getConfiguration().getRepositoryFilename(); > > > > > > > >> > > > >> } > > > >> > > > >> /** > > > >> * Insert the method's description here. > > > >> * Creation date: (06.12.2000 21:59:14) > > > >> */ > > > >> public void tearDown() > > > >> { > > > >> databaseName = null; > > > >> } > > > >> > > > >> /**TestThreadsNLocks state transition of modification states*/ > > > >> public void testModificationStates() > > > >> { > > > >> // get facade instance > > > >> Implementation odmg = OJB.getInstance(); > > > >> Database db = odmg.newDatabase(); > > > >> //open database > > > >> try > > > >> { > > > >> db.open(databaseName, Database.OPEN_READ_WRITE); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> ModificationState oldState = StateNewClean.getInstance(); > > > >> ModificationState newState = oldState.markDirty(); > > > >> assertEquals(StateNewDirty.getInstance(), newState); > > > >> > > > >> oldState = newState; > > > >> newState = oldState.markDirty(); > > > >> assertEquals(oldState, newState); > > > >> > > > >> > > > >> // close database > > > >> try > > > >> { > > > >> db.close(); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> > > > >> } > > > >> > > > >> public void testOdmgSession() > > > >> { > > > >> // get facade instance > > > >> Implementation odmg = OJB.getInstance(); > > > >> Database db = odmg.newDatabase(); > > > >> //open database > > > >> try > > > >> { > > > >> db.open(databaseName, Database.OPEN_READ_WRITE); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> Transaction tx = odmg.newTransaction(); > > > >> > > > >> //perform transaction > > > >> try > > > >> { > > > >> tx.begin(); > > > >> > > > >> Article example = new Article(); > > > >> example.setArticleId(777); > > > >> db.makePersistent(example); > > > >> > > > >> > > > >> > > > >> // modify Object > > > >> example.setStock(333); > > > >> example.addToStock(47); > > > >> example.addToStock(7); > > > >> example.addToStock(4); > > > >> > > > >> > > > >> //System.out.println("now commit all changes..."); > > > >> tx.commit(); > > > >> } > > > >> catch (Exception ex) > > > >> { > > > >> tx.abort(); > > > >> } > > > >> > > > >> // close database > > > >> try > > > >> { > > > >> db.close(); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> } > > > >> > > > >> public void testOQLQuery() > > > >> { > > > >> // get facade instance > > > >> Implementation odmg = OJB.getInstance(); > > > >> Database db = odmg.newDatabase(); > > > >> //open database > > > >> try > > > >> { > > > >> db.open(databaseName, Database.OPEN_READ_WRITE); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> Transaction tx = odmg.newTransaction(); > > > >> > > > >> //perform transaction > > > >> try > > > >> { > > > >> tx.begin(); > > > >> > > > >> > > > >> OQLQuery query = odmg.newOQLQuery(); > > > >> query.create("select anArticle from " + > > > >> > > > > Article.class.getName() + " where articleId = 7"); > > > > > > > >> List results = (List) query.execute(); > > > >> > > > >> Article a = (Article) results.get(0); > > > >> > > > >> > > > >> // cross check with PersistenceBroker lookup > > > >> // 1. get OID > > > >> Article example = new Article(); > > > >> example.setArticleId(7); > > > >> Identity oid = new Identity(example); > > > >> // 2. lookup object by OID > > > >> PersistenceBroker broker = > > OJB.getInstance().getBroker(); > > > >> broker.clearCache(); > > > >> Article b = (Article) broker.getObjectByIdentity(oid); > > > >> > > > >> assertEquals("should be same object", a, b); > > > >> > > > >> //System.out.println("now commit all changes..."); > > > >> tx.commit(); > > > >> } > > > >> catch (Exception ex) > > > >> { > > > >> tx.abort(); > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> > > > >> // close database > > > >> try > > > >> { > > > >> db.close(); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> } > > > >> > > > >> public void testNrmAndDlists() > > > >> { > > > >> // get facade instance > > > >> Implementation odmg = OJB.getInstance(); > > > >> Database db = odmg.newDatabase(); > > > >> //open database > > > >> try > > > >> { > > > >> db.open(databaseName, Database.OPEN_READ_WRITE); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> Transaction tx = odmg.newTransaction(); > > > >> > > > >> //perform transaction > > > >> try > > > >> { > > > >> tx.begin(); > > > >> > > > >> > > > >> OQLQuery query = odmg.newOQLQuery(); > > > >> query.create("select x from " + > > Article.class.getName() + " > > > >> > > > > where productGroupId = 7"); > > > > > > > >> DList results = (DList) query.execute(); > > > >> > > > >> > > > >> int originalSize = results.size(); > > > >> > > > >> OJB.getLogger().info(results); > > > >> > > > >> String name = "gimme fruits !"; > > > >> > > > >> db.bind(results, name); > > > >> tx.commit(); > > > >> > > > >> // clear the cache to make sure things are > > loaded from RDBMS > > ! > > > >> OJB.getInstance().getBroker().clearCache(); > > > >> > > > >> tx = odmg.newTransaction(); > > > >> tx.begin(); > > > >> > > > >> // look it up again > > > >> DList newResults = (DList) db.lookup(name); > > > >> > > > >> assertEquals(originalSize,newResults.size()); > > > >> OJB.getLogger().info(results); > > > >> > > > >> tx.commit(); > > > >> > > > >> > > > >> } > > > >> catch (Throwable t) > > > >> { > > > >> tx.abort(); > > > >> fail("ODMGException: " + t.getMessage()); > > > >> } > > > >> > > > >> // close database > > > >> try > > > >> { > > > >> db.close(); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> } > > > >> > > > >> > > > >> > > > >> public void testOQLQueryBind() > > > >> { > > > >> // get facade instance > > > >> Implementation odmg = OJB.getInstance(); > > > >> Database db = odmg.newDatabase(); > > > >> //open database > > > >> try > > > >> { > > > >> db.open(databaseName, Database.OPEN_READ_WRITE); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> Transaction tx = odmg.newTransaction(); > > > >> > > > >> //perform transaction > > > >> try > > > >> { > > > >> tx.begin(); > > > >> > > > >> > > > >> OQLQuery query = odmg.newOQLQuery(); > > > >> query.create("select anArticle from " + > > > >> > > > > Article.class.getName() + " where articleId = $678"); > > > > > > > >> query.bind(new Integer(7)); > > > >> > > > >> List results = (List) query.execute(); > > > >> > > > >> Article a = (Article) results.get(0); > > > >> > > > >> //crosscheck with PersistenceBroker lookup > > > >> // 1. get OID > > > >> Article example = new Article(); > > > >> example.setArticleId(7); > > > >> Identity oid = new Identity(example); > > > >> > > > >> ObjectCacheFactory.getObjectCache().clear(); > > > >> // 2. lookup object by OID > > > >> PersistenceBroker broker = > > OJB.getInstance().getBroker(); > > > >> broker.clearCache(); > > > >> Article b = (Article) broker.getObjectByIdentity(oid); > > > >> > > > >> assertEquals("should be same object", a, b); > > > >> > > > >> //System.out.println("now commit all changes..."); > > > >> tx.commit(); > > > >> } > > > >> catch (Exception ex) > > > >> { > > > >> tx.abort(); > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> > > > >> // close database > > > >> try > > > >> { > > > >> db.close(); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> } > > > >> > > > >> public void tesOQLQueryOnCollections() > > > >> { > > > >> // get facade instance > > > >> Implementation odmg = OJB.getInstance(); > > > >> Database db = odmg.newDatabase(); > > > >> //open database > > > >> try > > > >> { > > > >> db.open(databaseName, Database.OPEN_READ_WRITE); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> Transaction tx = odmg.newTransaction(); > > > >> > > > >> //perform transaction > > > >> try > > > >> { > > > >> tx.begin(); > > > >> OQLQuery query = odmg.newOQLQuery(); > > > >> query.create("select aLotOfArticles from " + > > > >> > > > > Article.class.getName() + " where productGroupId = 4"); > > > > > > > >> DCollection results = (DCollection) query.execute(); > > > >> results = results.query("price > 35"); > > > >> > > > >> // now perform control query > > > >> query = odmg.newOQLQuery(); > > > >> query.create("select aLotOfArticles from " + > > > >> > > > > Article.class.getName() + " where productGroupId = 4 and > > price > 35"); > > > > > > > >> DCollection check = (DCollection) query.execute(); > > > >> > > > >> assertEquals(results, check); > > > >> > > > >> > > > >> tx.commit(); > > > >> } > > > >> catch (Exception ex) > > > >> { > > > >> tx.abort(); > > > >> ex.printStackTrace(); > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> > > > >> // close database > > > >> try > > > >> { > > > >> db.close(); > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> fail("ODMGException: " + ex.getMessage()); > > > >> } > > > >> } > > > >> > > > >> > > > >> /**try to open non-existing db*/ > > > >> public void tesWrongDbName() > > > >> { > > > >> // get facade instance > > > >> OJB objectserver = OJB.getInstance(); > > > >> Database db = objectserver.newDatabase(); > > > >> > > > >> //try open database with non existing repository file: > > > >> String wrongDatabaseName = "ThereIsNoSuchFile"; > > > >> try > > > >> { > > > >> db.open(wrongDatabaseName, Database.OPEN_READ_WRITE); > > > >> fail("should not be able to open database " + > > > >> > > > > wrongDatabaseName); > > > > > > > >> } > > > >> catch (ODMGException ex) > > > >> { > > > >> return; > > > >> } > > > >> } > > > >>} > > > >> > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > Objectbridge-developers mailing list > > Obj...@li... > > https://lists.sourceforge.net/lists/listinfo/objectbridge-developers > > > |