objectbridge-developers Mailing List for ObJectRelationalBridge (Page 52)
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: Mahler T. <tho...@it...> - 2001-08-23 10:08:51
|
> -----Urspr=FCngliche Nachricht----- > Von: Lasse Lindg=E5rd [mailto:ll...@li...] > Gesendet: Donnerstag, 23. August 2001 11:51 > An: obj...@li... > Betreff: [Objectbridge-developers] generating mapping files and > databases >=20 >=20 > Let me guess:=20 1. Automatic generation of mapping files using=20 > reflection and >=20 2. a program that can create the database tables from the=20 > mapping files is > on the todo list ? >=20 1. Yes this a todo see the following tasks: http://sourceforge.net/pm/task.php?func=3Ddetailtask&project_task_id=3D2= 1214&gro up_id=3D13647&group_project_id=3D5389 http://sourceforge.net/pm/task.php?func=3Ddetailtask&project_task_id=3D2= 1115&gro up_id=3D13647&group_project_id=3D5389 2. This has already been done by Ivan Toshkov. Just extract the = attached zip file into the ojb src directory. Now you can use java ojb.broker.metadata repository.xml to generate the = DDL !!! This feature is brand new and will be included in the next release. <thomas/> > /Lasse >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > http://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: <ll...@li...> - 2001-08-23 09:52:05
|
Let me guess: Automatic generation of mapping files using reflection and a program that can create the database tables from the mapping files is on the todo list ? /Lasse |
From: Mahler T. <tho...@it...> - 2001-08-23 08:05:48
|
Hi Lasse, thanks for your interest! > -----Urspr=FCngliche Nachricht----- > Von: Lasse Lindg=E5rd [mailto:ll...@li...] > Gesendet: Mittwoch, 22. August 2001 23:44 > An: obj...@li... > Betreff: [Objectbridge-developers] ODMG or generic interface >=20 >=20 > Hi, >=20 > First: this project looks really cool! > I downloaded it, ran the examples and read the tutorial. It is well > written and I understood what was going on right away. Good job. >=20 > Now I am considering trying objectbridge for a real sample. >=20 > Could you explain to me - preferable in more than just one sentence - > what the difference between the two interfaces is ? >=20 The PersistenceBroker (PB) provides a minimal API for transparent persistence: - O/R mapping - Retrieval of objects with a simple query interface from RDBMS - storing (insert, update) of objects to RDBMS - deleting of objects from RDBMS This is all you need for simple applications as tutorial1. The OJB ODMG implementation uses the PB as its persistence kernel. But = it provides much more functionality to the application developer. ODMG is = a full fledged API for Object Persistence, including: - OQL Query interface - real Object Transactions - A Locking Mechanism for management of concurrent threads (apps) = accessing same objects - predefined persistent capable Collections and Hashtables I give some examples about the implications of these functional = differences: 1. Say you use the PB to query an object O that has a collection = attribute col with five elements a,b,c,d,e. Next you delete Objects d and e from col and store O again with=20 PersistenceBroker.store(O); PB will store the remaining objects a,b,c. But it will not delete d and = e ! If you then requery object O it will again contain a,b,c,d,e !!!=20 The PB keeps no transactional state of the persistent Objects, thus it = does not know that d and e have to be deleted. (as a side note: deletion of d and e could also be an error, as there = might be references to them from other objects !!!) Using ODMG for the above scenario will eliminate all trouble: Objects are registered to a transaction so that on commit of the = transaction it knows that d and e do not longer belong to the collection. the ODMG collection will not delete the objects d and e but only the REFERENCES = from the collection to those objects! 2. Say you have two threads (applications) that try to access and = modify the same object O. The PB has no means to check whether objects are used by concurrent threads. Thus it has no locking facilities. You can get all = kind of trouble by this situation. The ODMG implementation has A Lockmanager = that is capable of synchronizing concurrent threads. You can even use four transaction isolation levels: read-uncommitted, read-committed, repeatable-read, serializable. In my eyes the PB is a persistence kernel that can be used to build high-level PersistenceManagers like an ODMG or JDO implementation. It = can also be used to write simple applications, but you have to do all = management things (locking, tracking objects state, object transactions) on your = own. HTH, Thomas =20 =20 > Thanks > /Lasse >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > http://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: <ll...@li...> - 2001-08-22 21:44:38
|
Hi, First: this project looks really cool! I downloaded it, ran the examples and read the tutorial. It is well written and I understood what was going on right away. Good job. Now I am considering trying objectbridge for a real sample. Could you explain to me - preferable in more than just one sentence - what the difference between the two interfaces is ? Thanks /Lasse |
From: Thomas M. <tho...@ho...> - 2001-08-19 20:14:12
|
Hello Satish, sa...@na... wrote: > > Hi again, > > I have a few more questions..Any help is greatly > appreciated.. > > 1. Querying.. How can do I something as simple as > getting the max out of a column. > > I thought I could use Criteria of orderBy and use > queryByIterator and get the first one. Good idea. > But I dont > see any descending order on Criteria.orderBy(String). > Oops, you are right. I will add a signature Criteria.orderBy(String, boolean) to signal ascending or descending order. > 2. Broker and JDBC Connection: > > >From what I can see, Broker uses a single Connection object > for jdbc access for all classes by default. > I am using a single static instance of > PersistenceBroker for all the transcations and queries that > are potentially executed on multiple threads. I notice that > begin, end and commitTransaction methods are synchronized, > but query, store, delete methods are not. I guess I will have > to synchronize access to those methods. Am I right? > To use the PersistenceBroker as a singleton instance in a multithreaded environment is not recommended. The Broker can only handle one transaction at a time. For instance, If you called PB.beginTransaction() in one thread you will get a TransactionInProgressException if you call PB.beginTransaction() in a second thread! There is no need to synchronize query, store etc. but you have to keep in mind that ALL operation made after beginTransaction() belong to the same transaction. (In the above example the operations in thread 1 and 2 belong to the same transaction! If you need multiple transactions with multiple threads I would suggest to have a broker instance with each thread. Have a look at ojb.broker.server where I implemented a multithreaded PersistenceBrokerServer with multiple Brokers. HTH Thomas > Thanks, > Satish. > > -- > Get your firstname@lastname email for FREE at http://Nameplanet.com/?su |
From: Ralph B. <Ral...@st...> - 2001-08-17 10:35:00
|
Did anyone run OJB with Informix ? I have problems to run Tutorial2 and other testprogramms when i am using the ODMG methods : unwrapping conversion failed java.lang.IllegalArgumentException: unwrapping conversion failed at ojb.broker.accesslayer.JdbcAccess.readObjectFromResultSet(JdbcAccess.java:31 2) at ojb.broker.accesslayer.JdbcAccess.materializeObject(JdbcAccess.java:255) at ojb.broker.PersistenceBrokerImpl.store(PersistenceBrokerImpl.java:258) at ojb.broker.SequenceManager.getNextId(SequenceManager.java:119) at ojb.broker.SequenceManager.getUniqueId(SequenceManager.java:137) at ojb.broker.PersistenceBrokerImpl.getUniqueId(PersistenceBrokerImpl.java:1117 ) at ojb.odmg.collections.DListImpl.generateNewId(DListImpl.java:181) at ojb.odmg.collections.DListImpl.<init>(DListImpl.java:52) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:239) at ojb.broker.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl. java:636) at ojb.broker.PersistenceBrokerImpl.getCollectionByQuery(PersistenceBrokerImpl. java:696) at ojb.odmg.oql.OQLQueryImpl.execute(OQLQueryImpl.java:187) ( Has anyone a Informix-DB-Schema, maybe that it is a wrong DB-setup ) Ralph |
From: Mahler T. <tho...@it...> - 2001-08-17 09:48:22
|
Hi Christian, > -----Urspr=FCngliche Nachricht----- > Von: Christian Sell [mailto:chr...@ne...] > Gesendet: Donnerstag, 16. August 2001 22:47 > An: obj...@li... > Betreff: [Objectbridge-developers] CVS code usable? >=20 >=20 > Hello, >=20 > Is anybody using the CVS stuff? I checked it out today and=20 > found it did not > compile because lots of code were missing (e.g. ojb.server.*,=20 > which was > referenced from within test.ojb.server. >=20 ojb.server and test.ojb.server are obsolete packages. They are excluded = from compilation by the build XML script. > Also, when browsing online, there are 3 root modules: ojb,=20 > objectbridge, and > one named "c:userprojectsobjectbridge". I checked out=20 > "objectbridge", and it There have been several attempts to get things into cvs. The proper = root is "objectbridge". > looks to me like the source code was transferred from a=20 > windows machine onto > the server and then committed - there were binary zeroes at=20 > the end of every > line, which points to a mixup in line terminator conversion.=20 > My editor shows > these as double empty lines, which is less than ideal... >=20 David and I had a lot of trouble with this issue too: he was working = under windows and I made my cvs checkins from linux. I always had this problems with CR/LF with the stuff he checked in. But = As he has not checked in stuff for a long time and I had all his code run through Jindent there should be no problems ??? I will have a look at it at home... Thomas PS.: loading things from CVS does not help much: I'm checking in = immediately before a new release. So it's probably better to work with the released = tgz archives. > am I missing something? >=20 > thanks > Christian >=20 >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > http://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: Christian S. <chr...@ne...> - 2001-08-16 20:49:54
|
Hello, Is anybody using the CVS stuff? I checked it out today and found it did not compile because lots of code were missing (e.g. ojb.server.*, which was referenced from within test.ojb.server. Also, when browsing online, there are 3 root modules: ojb, objectbridge, and one named "c:userprojectsobjectbridge". I checked out "objectbridge", and it looks to me like the source code was transferred from a windows machine onto the server and then committed - there were binary zeroes at the end of every line, which points to a mixup in line terminator conversion. My editor shows these as double empty lines, which is less than ideal... am I missing something? thanks Christian |
From: Dirk O. <di...@xa...> - 2001-08-16 19:01:00
|
Mahler Thomas wrote: > > ... just a sidenote from my experiences using OJB with FrontBase: > > > > I would love to have a mechanism to be able to control the way the > > framework generates the SQL. All we need is basically there in the > > SqlGenerator class. I would imagine a configuration parameter in the > > mapping .xml file that allows me to specify the subclass of > > SqlGenerator > > that the framework would use in conjunction with my database. > > In general I think it's good to this kind of flexibility. > On the other hand I'd like to have the SqlGenerator as generic as possible > to cope with most RDBMS. While I appreciate a generic SqlGenerator, I would expect that with a rising number of supported DBMS one will end up in designing an API for dealing with SQL special to a specific DB server. I wouldn't complicate things unnecessarily, so let's wait until we really need to implement custom subclasses of SqlGenerator. > > This way I could have the framework do most of the work generating SQL > > for me and I'd just overwrite the methods that I need in order to make > > everything work with the database of my choice. In my special case it > > was the method quote() which is currently disabled but had to > > be enabled > > for my case. > > Are you sure you really need the quote method? I originally thought this > qouting of column names was required by SQL. but then I found that it was > only a common practise in my company to have these quotes. FrontBase claims to be very strictly conforming to the SQL standard. I found lots of SQL scripts that worked perfectly on other DBMS to be broken on FrontBase because of their strictness... But apart from this, it's a very fine, full-featured but lightweight DBMS. > If you have such double quotes in DDL code the quotes will be part to the > column names. So I think it would be a solution to have the quotes added in > the repository.xml. [...] > In the repository you will need: > <ClassDescriptor id="1"> > <class.name>MyClass</class.name> > <table.name>MYTABLE</table.name> > <FieldDescriptor id="1"> > <field.name>id</field.name> > <column.name>"ID"</column.name> [...] Sounds interesting. I'll give it a try! -dirk |
From: Mahler T. <tho...@it...> - 2001-08-16 07:12:48
|
Hallo Dirk > -----Urspr=FCngliche Nachricht----- > Von: Dirk Olmes [mailto:di...@xa...] > Gesendet: Mittwoch, 15. August 2001 20:49 > An: Mahler Thomas > Cc: 'Sa...@Ko...'; Objectbridge (E-Mail) > Betreff: Re: [Objectbridge-developers] AW: [Fwd: ObjectBridge with > Oracle] >=20 >=20 >=20 > > Hallo Sascha, > > =20 > > Thanks for you Code snippet.=20 > > I managed to get Oracle 8i and DB2 running on my machine.=20 > Now I am working on OJB=20 > > compatibility to DB2 and Oracle. This will > > include also the OJB internal database schema and all testcases. > > =20 > > I hope to get things finished this week ! >=20 > ... just a sidenote from my experiences using OJB with FrontBase: >=20 > I would love to have a mechanism to be able to control the way the > framework generates the SQL. All we need is basically there in the > SqlGenerator class. I would imagine a configuration parameter in the > mapping .xml file that allows me to specify the subclass of=20 > SqlGenerator > that the framework would use in conjunction with my database. In general I think it's good to this kind of flexibility.=20 On the other hand I'd like to have the SqlGenerator as generic as = possible to cope with most RDBMS. >=20 > This way I could have the framework do most of the work generating = SQL > for me and I'd just overwrite the methods that I need in order to = make > everything work with the database of my choice. In my special case it > was the method quote() which is currently disabled but had to=20 > be enabled > for my case. Are you sure you really need the quote method? I originally thought = this qouting of column names was required by SQL. but then I found that it = was only a common practise in my company to have these quotes. If you have such double quotes in DDL code the quotes will be part to = the column names. So I think it would be a solution to have the quotes = added in the repository.xml. For example in DDL you have=20 CREATE TABLE MYTABLE ( "ID" INT NOT NULL PRIMARY KEY, "VALUE" VARCHAR(50) ) In the repository you will need: <ClassDescriptor id=3D"1"> <class.name>MyClass</class.name> <table.name>MYTABLE</table.name> <FieldDescriptor id=3D"1"> <field.name>id</field.name> <column.name>"ID"</column.name> <jdbc_type>INTEGER</jdbc_type> <PrimaryKey>true</PrimaryKey> </FieldDescriptor> <FieldDescriptor id=3D"2"> <field.name>value</field.name> <column.name>"VALUE"</column.name> <jdbc_type>VARCHAR</jdbc_type> </FieldDescriptor> ... >=20 > -dirk >=20 |
From: Mahler T. <tho...@it...> - 2001-08-16 06:46:02
|
Hi Dirk, > -----Urspr=FCngliche Nachricht----- > Von: Dirk Olmes [mailto:di...@xa...] > Gesendet: Mittwoch, 15. August 2001 20:32 > An: Mahler Thomas > Cc: obj...@li... > Betreff: Re: AW: [Objectbridge-developers] optional relationships >=20 >=20 > > > > There is sample code for reflexive Joins in package > > > > test.ojb.broker have a > > > > look at classes Tree and TreeGroup and there respective=20 > mappings. > > > > The Junit test for this resides in class TreeTest. > > > > You will see that the root nodes of the trees don't have > > > > entries for a > > > > parentId while the child nodes have. > > > > You find the respective mappings in the repository.xml file. > > > > > > Well I can't get the Tree/TreeGroup example to run, it fails with > > > the following exception: > > > > > > java.sql.SQLException: Invalid parameter number: 1 > > > [...] > > > but that just as a side note. > > > > >=20 > > How do you run it? This testcase is part of the standard=20 > JUnit Testsuite and > > runs without errors with "build.sh junit" (or "build junit"=20 > under Windows) > > on Linux and windows. >=20 > I basically just run 'build junit' under Windows using the=20 > std. sun jdk > 1.3. Maybe it's the JDK? >=20 This is really strange! I've been running it on several NT and Linux = Boxes with a variety of VM's (incl. 1.3) and never had such an error. Can you provide me with a full stack trace? > > Or do you run it against a RDBMS other than instantDB? >=20 > No, just the stock instantDB. I didn't bother to setup a=20 > different test > database so far. >=20 > > > In the case where you have a database that allows for=20 > null values for > > > the parentId, you will run into exactly the problem, it's in > > > JdbcAccess::readObjectFromResultSet(), either in line 317=20 > or in line > > > 331, depending on your class having a multi-arg=20 > constructor or not. > > > > > > There, JdbcAccess tries to assign (int)null to an=20 > instance variable of > > > the value class which fails because java.lang.reflect=20 > just cannot do > > > this. > > > > >=20 > > I changed line 331 as follows: > > // if val =3D=3D null and the field-type is primitive do NOT=20 > set the attribute! > > if ((val !=3D null) || (! > > fmd.getPersistentField().getDeclaringClass().isPrimitive())) > > fmd.getPersistentField().set(obj, conversion.sqlToJava(val, = fmd)); > >=20 > > For line 317 it's not so easy: > > The Constructor is defined in the Client Application thus=20 > it lies in the > > responsibility of the Application developer. I have no=20 > chance to handle this > > within OJB. IMO the developer has to handle this situation in the > > constructor. >=20 > Well, in this case we should either have good documentation on this > behaviour.=20 Yes! I will add a special note on this in the "constructor missing" = warning. > Maybe it's a better idea to start looking for a constructor > that doesn't include the parameter so as a developer I could = implement > constructors for both cases. Then again, if you have more than one = int > that could allow for NULL you would end up implementing lots of > constructors ... I would prefer to stay with this single constructor for two reasons: 1. this (optional) constructor is already an intrusion into the clients code. Having even more Constructors would increase the burden of the application developer to be OJB-compliant. 2. To have all these constructors and to select the correct one = according to nulled primitive attributes would make the above piece of code much = more complicated. -- Thomas >=20 > -dirk >=20 |
From: Dirk O. <di...@xa...> - 2001-08-15 18:50:06
|
> Hallo Sascha, > > Thanks for you Code snippet. > I managed to get Oracle 8i and DB2 running on my machine. Now I am working on OJB > compatibility to DB2 and Oracle. This will > include also the OJB internal database schema and all testcases. > > I hope to get things finished this week ! ... just a sidenote from my experiences using OJB with FrontBase: I would love to have a mechanism to be able to control the way the framework generates the SQL. All we need is basically there in the SqlGenerator class. I would imagine a configuration parameter in the mapping .xml file that allows me to specify the subclass of SqlGenerator that the framework would use in conjunction with my database. This way I could have the framework do most of the work generating SQL for me and I'd just overwrite the methods that I need in order to make everything work with the database of my choice. In my special case it was the method quote() which is currently disabled but had to be enabled for my case. -dirk |
From: Dirk O. <di...@xa...> - 2001-08-15 18:40:22
|
> > > There is sample code for reflexive Joins in package > > > test.ojb.broker have a > > > look at classes Tree and TreeGroup and there respective mappings. > > > The Junit test for this resides in class TreeTest. > > > You will see that the root nodes of the trees don't have > > > entries for a > > > parentId while the child nodes have. > > > You find the respective mappings in the repository.xml file. > > > > Well I can't get the Tree/TreeGroup example to run, it fails with > > the following exception: > > > > java.sql.SQLException: Invalid parameter number: 1 > > [...] > > but that just as a side note. > > > > How do you run it? This testcase is part of the standard JUnit Testsuite and > runs without errors with "build.sh junit" (or "build junit" under Windows) > on Linux and windows. I basically just run 'build junit' under Windows using the std. sun jdk 1.3. Maybe it's the JDK? > Or do you run it against a RDBMS other than instantDB? No, just the stock instantDB. I didn't bother to setup a different test database so far. > > In the case where you have a database that allows for null values for > > the parentId, you will run into exactly the problem, it's in > > JdbcAccess::readObjectFromResultSet(), either in line 317 or in line > > 331, depending on your class having a multi-arg constructor or not. > > > > There, JdbcAccess tries to assign (int)null to an instance variable of > > the value class which fails because java.lang.reflect just cannot do > > this. > > > > I changed line 331 as follows: > // if val == null and the field-type is primitive do NOT set the attribute! > if ((val != null) || (! > fmd.getPersistentField().getDeclaringClass().isPrimitive())) > fmd.getPersistentField().set(obj, conversion.sqlToJava(val, fmd)); > > For line 317 it's not so easy: > The Constructor is defined in the Client Application thus it lies in the > responsibility of the Application developer. I have no chance to handle this > within OJB. IMO the developer has to handle this situation in the > constructor. Well, in this case we should either have good documentation on this behaviour. Maybe it's a better idea to start looking for a constructor that doesn't include the parameter so as a developer I could implement constructors for both cases. Then again, if you have more than one int that could allow for NULL you would end up implementing lots of constructors ... -dirk |
From: Mahler T. <tho...@it...> - 2001-08-15 10:01:52
|
Hi all, I just finished my work on the big compatibility issue. The result looks promising: It's now possible to run all Junit testcases directly with build junit against instantDB, Oracle and DB2. You only have to point to the respective Database in the files src/test/setup/sql1.txt and src/test/ojb/repository.xml (I have included sample entries at the top of both files) I think that my fixes should solve problems not only with Oracle and DB2 but also with other drivers. So I'd like to invite you to extensive testing. I will make a new official release by the weekend. If you are interested in getting the stuff asap just drop me a line. I will send you a zip file which replaces the contents of the src/ directory of release 0.5.151. cheers, Thomas |
From: Mahler T. <tho...@it...> - 2001-08-15 07:01:02
|
Hallo Sascha, =20 Thanks for you Code snippet.=20 I managed to get Oracle 8i and DB2 running on my machine. Now I am = working on OJB compatibility to DB2 and Oracle. This will include also the OJB internal database schema and all testcases. =20 I hope to get things finished this week ! =20 cheers, =20 Thomas -----Urspr=FCngliche Nachricht----- Von: Thomas Mahler [mailto:tho...@ho...] Gesendet: Dienstag, 14. August 2001 20:36 An: tom Betreff: [Fwd: ObjectBridge with Oracle] =20 -------- Original Message --------=20 Subject: ObjectBridge with Oracle=09 Date: Tue, 14 Aug 2001 10:34:46 -0600=09 From: "Sascha A. Koenig" <Sa...@Ko...>=09 To: "Thomas Mahler" <tho...@ho...>=09 Hi Thomas,der folgende Code ist vieleicht hilfreich um ObJectBridge = mit Oracle ans Laufen zu bekommen (wg. BigDecimal problem):Sascha =20 import ojb.broker.ConversionStrategy;=20 import ojb.broker.metadata.FieldDescriptor; public class OracleConversionStrategy implements ojb.broker.ConversionStrategy {=20 public Object javaToSql(Object source, FieldDescriptor fld) {=20 return source;=20 }=20 public Object sqlToJava(Object source, FieldDescriptor fld) {=20 if (fld.getColumnType().equalsIgnoreCase("INT") || fld.getColumnType().equalsIgnoreCase("INTEGER"))=20 return new Integer( ((Number)source).intValue());=20 else if (fld.getColumnType().equalsIgnoreCase("LONG"))=20 return new Long( ((Number)source).longValue());=20 else if (fld.getColumnType().equalsIgnoreCase("SHORT"))=20 return new Short( ((Number)source).shortValue());=20 else if (fld.getColumnType().equalsIgnoreCase("DOUBLE"))=20 return new Double( ((Number)source).doubleValue());=20 else if (fld.getColumnType().equalsIgnoreCase("FLOAT"))=20 return new Float( ((Number)source).floatValue());=20 // else if (fld.getColumnType().equalsIgnoreCase("NUMERIC")) // = don't know the right mapping=20 // return new Integer( ((Number)source).intValue());=20 else=20 return source;=20 }=20 }__________________________=20 Sascha A. Koenig=20 CCS-1, MS T006Computer and Computational Sciences=20 Los Alamos National Laboratory=20 Los Alamos, NM 87545 phone: +1 (505) 663-5217 cellular: +1 (505) 670-4643fax: +1 (505) 665-4939 http://www.OpenEMed.org <http://www.openemed.org/> =20 |
From: Mahler T. <tho...@it...> - 2001-08-15 06:56:04
|
Hi Dirk, > -----Urspr=FCngliche Nachricht----- > Von: Dirk Olmes [mailto:di...@xa...] > Gesendet: Montag, 13. August 2001 18:52 > An: Mahler Thomas; obj...@li... > Betreff: Re: AW: [Objectbridge-developers] optional relationships >=20 >=20 > Mahler Thomas wrote: > >=20 > > Hi Dirk, >=20 > Hi, >=20 > > There is sample code for reflexive Joins in package=20 > test.ojb.broker have a > > look at classes Tree and TreeGroup and there respective mappings. > > The Junit test for this resides in class TreeTest. > > You will see that the root nodes of the trees don't have=20 > entries for a > > parentId while the child nodes have. > > You find the respective mappings in the repository.xml file. >=20 > Well I can't get the Tree/TreeGroup example to run, it fails with > the following exception: >=20 > java.sql.SQLException: Invalid parameter number: 1 > [...] > but that just as a side note. >=20 How do you run it? This testcase is part of the standard JUnit = Testsuite and runs without errors with "build.sh junit" (or "build junit" under = Windows) on Linux and windows. Or do you run it against a RDBMS other than instantDB?=20 > After digging around in the testcase, however I find that you never > encounter the case that I have described above mainly because the = Tree > instance will be created by the testcase. When creating a new Tree > instance, the parentId is zero ( (int)0 ). When it's saved to the > database, the db will happily accept zero and return it later when = the > test queries all of the Tree instances. >=20 > In my test I filled the database "by hand" and ran into this error. >=20 > The fact that the foreign key defaults to zero is not=20 > formally correct, > though. Note that the foreign key has a value assigned: it's=20 > zeor which > is not the same as NULL ( (int)null ). I would not want to impose any > restrictions on primary key values (or foreign key values)=20 > just to make > the framework do it's work (although this is the workaround I have > chosen for now). Just imagine someone else using the same=20 > database with > a different tool/persistence framework. >=20 Yes you are right, this is really a bug! > In the case where you have a database that allows for null values for > the parentId, you will run into exactly the problem, it's in > JdbcAccess::readObjectFromResultSet(), either in line 317 or in line > 331, depending on your class having a multi-arg constructor or not. >=20 > There, JdbcAccess tries to assign (int)null to an instance variable = of > the value class which fails because java.lang.reflect just cannot do > this. >=20 I changed line 331 as follows: // if val =3D=3D null and the field-type is primitive do NOT set the = attribute! if ((val !=3D null) || (! fmd.getPersistentField().getDeclaringClass().isPrimitive())) fmd.getPersistentField().set(obj, conversion.sqlToJava(val, fmd)); For line 317 it's not so easy: The Constructor is defined in the Client Application thus it lies in = the responsibility of the Application developer. I have no chance to handle = this within OJB. IMO the developer has to handle this situation in the constructor. cheers, Thomas P.S.: Apropos PING: ist das nicht die Private Internet Nutzer Gruppe = aus dem Raum Dortmund? Dann sind wir r=E4umlich nicht soweit auseinander (Ich = wohne in Essen)... > > I don't see how the formal usage of a foreign key in the=20 > database schema > > could cause problems?! >=20 > Me neither, maybe it's just a different interpretation of the term > foreign key? >=20 > -dirk >=20 |
From: Thomas M. <tho...@ho...> - 2001-08-13 18:37:10
|
-------- Original Message -------- Subject: RE: Use of term "Objectbridge"] Date: Mon, 13 Aug 2001 10:59:44 -0700 From: "Linda" <li...@ac...> Reply-To: <li...@ac...> To: "Thomas Mahler" <tho...@ho...> Thomas, Thanks for your response and your attention to this. It is acceptable to Actional that you keep the URL using the Objectbridge term as it would be difficult to change. Many thanks for your cooperation in this and good luck on your project! Regards, Linda -----Original Message----- From: to...@ma... [mailto:to...@ma...]On Behalf Of Thomas Mahler Sent: Sunday, August 12, 2001 10:21 PM To: li...@ac... Subject: Re: Use of term "Objectbridge"] Hi Linda, I was on vacation, thus there was some delay in the process of renaming our project. But since Saturday its officially named ObJectRelationalBridge. We also changed all Logos accordingly and all references in documentation and sourcecode. One thing we could not change is the URL of the project at sourceforge (objectbridge.sourceforge.net). For some reason this name is fixed. To get this URL changed would require to launch a totally new project which would bring a lot more work with it. I hope this is OK for you. Regards, Thomas Mahler Linda wrote: > > Hi Thomas, > > Thank you for the email. I did receive it but was out of the office some of > yesterday and unable to respond right away. > > We would agree that your new name is different enough from our ObjectBridge > name to avoid confusion. It seems like a good name to me. I understand it > will take some time for you to change from the use of ObjectBridge to your > new name, which is fine. > > Thank you for your kindness and cooperation in working this out. I wish you > and the people in your group success in your programming. Good luck! > > Regards, > > Linda > > ******************************* > Linda Whillock > Contracts Manager > Actional Corporation > 701 N. Shoreline Blvd. > Mountain View, CA 94043 > 650.254.4117 (Phone) > 650.254.4101 (Fax) > li...@ac... <mailto:li...@ac...> > > Actional delivers a high-performance integration architecture > that works with your existing systems and applications, > without adding new middleware. Actional's Control Broker > platform allows you to utilize enterprise services across > hundreds of applications with broad support for industry > standards like XML, Java, EJB, COM, and CORBA. > -----Original Message----- > From: to...@ma... [mailto:to...@ma...]On Behalf Of > Thomas Mahler > Sent: Tuesday, July 10, 2001 3:12 PM > To: li...@ac... > Subject: Re: Use of term "Objectbridge"] > > Dear Linda, > > I send an email to you yesterday, but due to a battery problem with my > PC it was dated 01 Jan 1997. So may be you did not see it in your inbox? > > Here it is again: > > -------- Original Message -------- > Subject: Re: Use of term "Objectbridge" > Date: Wed, 01 Jan 1997 00:24:38 +0100 > From: Thomas Mahler <tho...@ho...> > Organization: NOORG > To: li...@ac... > References: <NEB...@ac...> > > Dear Linda, > > After some internal discussions we now found a name for our project that > will hopefully be acceptable for all of us. > > Our favourite name is "ObJectRelationalBridge". We hope that you have no > objections against this name? ! > We think it's quite different from your trademarked term and does reveal > even more about the purpose of our project than the old one. > I already prepared our documentation for this new name. If you consent > to this name I will have a new release and a WebSite update within this > week. > > I hope you can accept our suggestion, > > best regards, > > Thomas Mahler > > Linda wrote: > > > > Dear Thomas, > > > > Thank you for the response. I understand that this is a volunteer project > > and wish you well in the development of your software. Unfortunately, we > do > > consider that use of the name "ObJectBridge" would be considered a > trademark > > infringement under the Lanham Act, Section 1114. Even though you will not > > be charging money for your software, it still would (and will) be > considered > > a product that is distributed to the public. Also, we believe since the > > name is nearly identical (the capitalization change does not make it truly > > different), our products are similar, and some of our users may be in > > similar fields, the use of the ObjectBridge name for your software would > > likely cause confusion or possible mistake. Since the point of > trademarking > > is to avoid confusion in the marketplace, we believe there is possible > > confusion in your use of the name ObJectBridge. > > > > Because of this, we would like to ask you to please find another name to > use > > other than ObJectBridge. Unfortunately, we must insist on this. I > > understand this may take some time per your email. > > > > Please email or call if you have any questions. Good luck with your work. > > > > Regards, > > > > Linda > > > > ****************************** > > Linda Whillock > > Contracts Manager > > Actional Corporation > > 701 N. Shoreline Blvd. > > Mountain View, CA 94043 > > 650.254.4117 (Phone) > > 650.254.4101 (Fax) > > li...@ac... <mailto:li...@ac...> > > > > Actional delivers a high-performance integration architecture > > that works with your existing systems and applications, > > without adding new middleware. Actional's Control Broker > > platform allows you to utilize enterprise services across > > hundreds of applications with broad support for industry > > standards like XML, Java, EJB, COM, and CORBA. > > > > -----Original Message----- > > From: to...@ma... [mailto:to...@ma...]On Behalf Of > > Thomas Mahler > > Sent: Tuesday, December 31, 1996 4:02 PM > > To: Linda > > Cc: objectbridge > > Subject: Re: Use of term "Objectbridge" > > > > Dear Linda, > > > > We did not intent to conflict with your trademark. "ObJectBridge" (note: > > it is not spelled "Objectbridge", "ObjectBridge" or "Object Bridge") is > > a non-commercial OpenSource project driven by an international developer > > community, mediated by SourceForge.net. > > It is not a "Product" according to the conventional notion: > > There is no Vendor, there is no Product that is sold to customers, etc. > > Can there be a trademark conflict without two Vendors trading two > > Products under the same name? > > I'm not a lawyer but I don't see a conflict here?! > > > > We will of course change the Name of our Project if you insist. > > > > We had some internal discussion's on alternative names but did not come > > to a final conclusion. > > > > It will take us a while to change all Documents, sources and graphics as > > we all are only vonlunteering on this project. > > > > best regards, > > > > Thomas Mahler > > > > And we will of course change ou > > > > Linda wrote: > > > > > > Dear Mr. Mahler, > > > > > > I noticed that you have used the name Objectbridge for your > > > software. Unfortunately the name Object bridge was > > > trademarked on 6/23/96 by Visual Edge Software and has been > > > in use regularly as our product name. You can confirm this > > > through the patent and trademark office's website. I > > > noticed that your product is in beta version still and hope > > > you might be able to please chose another name for your > > > product which would not conflict with ours. > > > > > > Many thanks for your cooperation in this. You can reach me > > > at li...@ac... (or visit our website at > > > actional.com). Actional Corporation was formerly Visual > > > Edge Software. > > > > > > -- Linda > > > > > > |
From: Dirk O. <di...@xa...> - 2001-08-13 17:01:05
|
Joel Cordonnier wrote: > > > 1) extend the mapping to let the user specify which > > value object he > > wants to have assigned for individual attributes. So > > there would be a > > <field.valueType/> in addition <field.name/> node in > > the mapping XML > > file. This would allow for e.g. Integer values to be > > passed. To make > > this work with reflection, JdbcAccess should use a > > set method if that's > > available (could be found out using reflection) > > ok ! And what bring this solution ? to assign a given > value, when you can the type ?? It's all about distinguishing a NULL value that comes from the database from an (int)0. The two *are* different and you have to make sure that your app can see which case is which. Using just int's you cannot distinguish. Using java.lang.Integer gets you further: int foo = 0; // is that NULL or really zero Integer foo = null; // this really means NULL Integer foo = new Integer(0); // this is the Integer value zero. > I think that the second solution (eg. implement the > interface) is better. Does anybody know what other O/R mapping frameworks do? I have some working knowledge with Apple's Enterprise Objects Framework, they call a method named unableToTakeNullForKey(String key) on the instance that's about to have a NULL value assigned. -dirk |
From: Dirk O. <di...@xa...> - 2001-08-13 17:01:05
|
Mahler Thomas wrote: > > Hi Dirk, Hi, > There is sample code for reflexive Joins in package test.ojb.broker have a > look at classes Tree and TreeGroup and there respective mappings. > The Junit test for this resides in class TreeTest. > You will see that the root nodes of the trees don't have entries for a > parentId while the child nodes have. > You find the respective mappings in the repository.xml file. Well I can't get the Tree/TreeGroup example to run, it fails with the following exception: java.sql.SQLException: Invalid parameter number: 1 [...] but that just as a side note. After digging around in the testcase, however I find that you never encounter the case that I have described above mainly because the Tree instance will be created by the testcase. When creating a new Tree instance, the parentId is zero ( (int)0 ). When it's saved to the database, the db will happily accept zero and return it later when the test queries all of the Tree instances. In my test I filled the database "by hand" and ran into this error. The fact that the foreign key defaults to zero is not formally correct, though. Note that the foreign key has a value assigned: it's zeor which is not the same as NULL ( (int)null ). I would not want to impose any restrictions on primary key values (or foreign key values) just to make the framework do it's work (although this is the workaround I have chosen for now). Just imagine someone else using the same database with a different tool/persistence framework. In the case where you have a database that allows for null values for the parentId, you will run into exactly the problem, it's in JdbcAccess::readObjectFromResultSet(), either in line 317 or in line 331, depending on your class having a multi-arg constructor or not. There, JdbcAccess tries to assign (int)null to an instance variable of the value class which fails because java.lang.reflect just cannot do this. > I don't see how the formal usage of a foreign key in the database schema > could cause problems?! Me neither, maybe it's just a different interpretation of the term foreign key? -dirk |
From: Thomas M. <tho...@ho...> - 2001-08-12 13:21:21
|
Hi again Satish sa...@na... wrote: > Hi Thomas, > > Thank you so much for your detailed reply. > Yep, I ended up using the "set id in constructor approach". > > Right now, I am faced with a different problem. > Basically, how to do queries involving joins using Query and Criteria > classes. > > For example, 3 tables - Visit, Student and Course > > Visit { > date; > Student s; > student_fkey > Course c; > course_fkey; > } > > Student { > name; > } > > Course { > id; > } > > I would like to be able to do queries such as > SELECT * FROM VISIT as v, STUDENT AS s, COURSE AS c > WHERE v.student_fkey = s.id AND v.course_fkey = c.id AND s.FNAME="foo" AND > c.ID="bar"; > ie., retrieve all visits with student.name="foo" and course.id="bar" > > However, I noticed that QueryByCriteria uses one search class. But > the above query involves multiple classes. It includes multiple classes but from an OO point of view you just want to select objects from the class Visit that match certain criteria. Namely select all visits v where v.student.name = "foo" and v.course.id = "bar" Such a query can be simply formulated with QueryByCriteria. There is only one problem: the SqlGenrator that translates Query objects to SQL statements currently does not support path-expressions (something like "student.name") which would involve gereration of SQL joins. Thus there is currently no way to build such a query with OJB :-( Your idea regarding OQL is good. Of course OQL supports such path expressions. Unfortunately there is only little material available online. The only thing I know is the OQL grammar from the odmg site which ships with OJB (file oql-ojb.g). This might help you in writing the above query as an OQL statement. BUT! (here comes the second bad news) OJB internally parses all OQL statements to QueryByCriteria Objects (and translated by the SQLGenerator to SQL). So we have the same limitation for OQL too! :-( Those are poor facts. But what to do now? Some volunteer (not me again, please ;-)) has to enhance the SqlGenerator. But this will take too long for your immediate needs. So what can you do? I would try the following. use PersistenceBroker.getIteratorByQuery() with a query returning ALL Visits. Then step through the Iterator and collect all those Visits v with v.student.name = "foo" and v.course.id = "bar" into a result collection. This "hack" will of course only work with an acceptable performance if the Visit table is not too big. HTH, Thomas > > > I looked at the source code for OJBSearchFilter. I tried to use it > but I could not get the Criteria built since getCriteria() is protected. > > I am not very familiar with ODMG. My guess at this point is to > that I will need to use OQL for these kinds of queries. > > Can you please give me some pointers.. > > Thanks very much for your time, > Satish. > > On Mon, 06 Aug 2001 10:12:24 +0200 Thomas Mahler <tho...@ho...> wrote: > >Hi Satish, > > > >sorry for the delay. I was on vacation and could not answer earlier! > > > >Satish wrote: > >> > >> I started playing with ObjectBridge.. Very useful > >> and full featured.. I am really impressed. Thanks... > >> > > > >And we are including still more and moe features... ;-) > > > >> Before, I ask the question below, can you please send > >> me a copy of the tutorial#3 that covers advanced mapping > >> issues, if you dont mind, even if it is unfinished. > > > >Sorry, but I did not yet start this tutorial :-( > >But as I get more and more request for it I will have to start it > >soon... > >For the time beeing you can have a look at the sample code in package > >test.ojb.broker > >where all ojb features a evaluated with JUNIT testcases. > >If you don't find your way, just ask me... > > > >> It > >> will greatly help me in figuring out how to approach > >> common problems. The examples are useful, but I still have > >> a whole lot of questions.. maybe because, I am still new > >> to the object-relational mapping implementation issues. > >> > >> I would like some help with the following problem. It is not > >> so much an objectbridge question as it is a obj-rel mapping > >> question. > >> > >> Consider the following: > >> > >> class Person { > >> Person(Address addr,....) { ... } > >> private Address _addr; > >> private int _oid; > >> private int _addr_oid; > >> } > >> > >> class Address { > >> .. > >> } > >> > >> So, somewhere in the application, we save the person > >> to the database: > >> class Foo { > >> > >> public void foo() { > >> broker.store(person); > >> } > >> } > >> > >> Before we do the store, we need to make sure that > >> OIDs of both the person and the contained addr reference > >> object are set. So, my question is: who is responsible > >> for setting the OID and when? Possible ways are and the > >> problems with each approach are: > >> > >> - on object creation time in the constructor of the > >> persistable object? > >> Problem: Not every created object may be stored in the db. > >> > >> - just before storage by each owning class. > >> Problem: Person above will need to have a store method that > >> can check if the object ids are not set and if not set them > >> before calling broker.store(). > >> > >> - by foo() above, but then how does it set the private > >> _addr_id in Person unless exposed by Person via setAddrId(). > >> Problem: what happens if you have a vector of addresses. > >> Do we provide setAddressIds() that just iterates and calls > >> ((Addresss)list.get(i)).setId(Sequence...) on each addr in > >> the list? > >> > >> Basically, I would like to hear your thoughts on approaching > >> this problem.. > > > >Sure, this is problem that has nothing to do with the problem domain, > >but is a technical problem that arises from the use of a relational > >database. > >OJB was build to work with legacy database schemas with given primary > >keys. Thus there is no built-in auto-OID feature. So with OJB the > >application developer is responsible for the proper assignment of > >primary keys. This is a violation of the design principle of > >"transparent persistence" but I see no other solution for such a generic > >approach. > > > >I generally recommend to calculate ids within constructor code. I prefer > >to waste some unused ids rather than fighting with the problems of your > >two other solutions. > > > >See following example code from > >ojb.odmg.collections.DListImpl.java > > > > /** > > * DListImpl constructor comment. > > */ > > public DListImpl() > > { > > super(); > > elements = new Vector(); > > id = generateNewId(); // compute unique id for this > >object > > this.size = 0; > > } > > > > /** > > * return a unique id for PK > > */ > > private int generateNewId() > > { > > return SequenceManager.getUniqueId(DListImpl.class, > >"id"); > > } > > > >SequenceManager is an OJB HelperClass that maintains unique long ints > >for class-attribute pairs. > > > >best regards, > > > > > >Thomas > > > > > >> > >> Thanks, > >> Satish. > >> > >> > >> > >> ( > > > > > > -- > Get your firstname@lastname email for FREE at http://Nameplanet.com/?su |
From: Mahler T. <tho...@it...> - 2001-08-10 12:08:58
|
Hi again, > -----Urspr=FCngliche Nachricht----- > Von: Geir Ove Gr=F8nmo [mailto:gr...@on...] > Gesendet: Freitag, 10. August 2001 10:27 > An: obj...@li... > Betreff: Re: [Objectbridge-developers] Querying databases (including > local transactions changes) >=20 >=20 > * Geir Ove Gr=F8nmo > | It does also not have support for something like a=20 > savepoint where the > | changes up till the current point in the transaction is actually > | stored in the database without the transaction being commited. This > | would allow the query results to be conformed automatically by the > | database. > |=20 > | I guess savepoint would also be the most efficient way of = supporting > | such a feature - at least if there were support to actually=20 > only store > | modifications that are relevant to the query you've about to > | execute. In TopLink this is often not very efficient, since=20 > it is very > | hard upfront knowing how to store the changes to=20 > efficiently sync the > | database result with the inmemory-result. > |=20 > | Does ObjectBridge have support for conforming queries=20 > either in-memory > | or in the database via savepoints? >=20 > Being able to just save individual objects (not necessarily all > transaction changes) in the database should be sufficient for=20 > my current > needs. >=20 > PersistenceBroker.savepoint() or PersistenceBroker.save(Object = object) > would be fine. :) The PersistenceBroker.store(object) method works in two modi: 1. No call to PersistenceBroker.beginTransaction() has been made (i.e. connection.autoCommit =3D true). Then all store() Operations are directly written to the DB AND = commited. 2. PersistenceBroker.beginTransaction() has been called. Then the database inserts and updates are excecuted, but commit is done = only on a subsequent call to PersistenceBroker.commitTransaction() I'm planning to have a special operation likePersistenceBroker.storeImmediate(object) that ignores all = transactions and directly commits it's operations. I will need this feature for a database lock handling (I want to maintain a table that keeps track of transactional locks on objects.) If you urgently need this I could try = to code a bit faster :-) cheers Thomas >=20 > Does PersistenceBroker.store(Object object) actually do this? The > javadoc is somewhat unclear on whether the database is modified or = not > when this method is called. Are related objects also stored=20 > when calling > this method? >=20 > Geir O. >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > http://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |
From: Mahler T. <tho...@it...> - 2001-08-10 12:00:41
|
Hi Geir Ove, Hello all! I really haven't started using ObjectBridge yet, but I have some experience already using TopLink and Castor JDO. I've been able to successfully use TopLink in the project doing. Unfortunately TopLink is extremely expensive and the licensing is not really very flexible for the use I'm interested in. Secondly being able to peek at the source code whenever I'm stuck is _extremely_ useful to say the least. So, I tried switching to Castor JDO, which I have the impression is quite a nice framework. From what I've seen so far - it is. Unfortunately my project rely heavily on querying the object model during transactions (before commiting), so the query results must be conformed with the local transaction changes somehow. I'm not quite sure if I get you mean by "conformed with". Do you mean the following? say you have a class Articles with an attribute price. You perform a query with price < 100. Then you operate on the found articles and for some articles you set the price to 250. Then you perform the query again (within the same tx) and want to have the objects with price set to 250 NOT included in the query result? This is a thing OJB can't do as all queries are translated to SQL and go to the database (and do not work on in-memory objects). Or do you mean the following: during a transaction you change an article A to A' and then perform (within same tx) a query that returns also article A. You want of course to see your modified article A' and not the original A. This works with OJB due to its caching algorithms. TopLink has a feature called conformInUnitOfWork, which lets you do this. There were some missing parts, but I where able to tweak everything to make this work. TopLink doesn't actually modify the database until commit at all (except for sequence counters that is). So TopLink was up to the task. In OJB there are also NO database write until a commit ist performed. (except for sequence counters...) Then I tried Castor which actually modifies the database whenever objects are created (inserts a row with the default values), and on commit (of course), but not when they are modified. Castor does not, like TopLink, have support for conforming query results in-memory. It does also not have support for something like a savepoint where the changes up till the current point in the transaction is actually stored in the database without the transaction being commited. This would allow the query results to be conformed automatically by the database. The OJB ODMG implementation supports checkpoints. Currently they have the same semantics as commits. :-( But this could easily be changed. HTH Thomas I guess savepoint would also be the most efficient way of supporting such a feature - at least if there were support to actually only store modifications that are relevant to the query you've about to execute. In TopLink this is often not very efficient, since it is very hard upfront knowing how to store the changes to efficiently sync the database result with the inmemory-result. Does ObjectBridge have support for conforming queries either in-memory or in the database via savepoints? All the best, Geir O. _______________________________________________ Objectbridge-developers mailing list Obj...@li... http://lists.sourceforge.net/lists/listinfo/objectbridge-developers <http://lists.sourceforge.net/lists/listinfo/objectbridge-developers> |
From: Geir O. G. <gr...@on...> - 2001-08-10 08:25:20
|
* Geir Ove Gr=F8nmo | It does also not have support for something like a savepoint where the | changes up till the current point in the transaction is actually | stored in the database without the transaction being commited. This | would allow the query results to be conformed automatically by the | database. |=20 | I guess savepoint would also be the most efficient way of supporting | such a feature - at least if there were support to actually only store | modifications that are relevant to the query you've about to | execute. In TopLink this is often not very efficient, since it is very | hard upfront knowing how to store the changes to efficiently sync the | database result with the inmemory-result. |=20 | Does ObjectBridge have support for conforming queries either in-memory | or in the database via savepoints? Being able to just save individual objects (not necessarily all transaction changes) in the database should be sufficient for my current needs. PersistenceBroker.savepoint() or PersistenceBroker.save(Object object) would be fine. :) Does PersistenceBroker.store(Object object) actually do this? The javadoc is somewhat unclear on whether the database is modified or not when this method is called. Are related objects also stored when calling this method? Geir O. |
From: Geir O. G. <gr...@on...> - 2001-08-10 07:45:54
|
Hello all! I really haven't started using ObjectBridge yet, but I have some experience already using TopLink and Castor JDO. I've been able to successfully use TopLink in the project doing. Unfortunately TopLink is extremely expensive and the licensing is not really very flexible for the use I'm interested in. Secondly being able to peek at the source code whenever I'm stuck is _extremely_ useful to say the least. So, I tried switching to Castor JDO, which I have the impression is quite a nice framework. From what I've seen so far - it is. Unfortunately my project rely heavily on querying the object model during transactions (before commiting), so the query results must be conformed with the local transaction changes somehow. TopLink has a feature called conformInUnitOfWork, which lets you do this. There were some missing parts, but I where able to tweak everything to make this work. TopLink doesn't actually modify the database until commit at all (except for sequence counters that is). So TopLink was up to the task. Then I tried Castor which actually modifies the database whenever objects are created (inserts a row with the default values), and on commit (of course), but not when they are modified. Castor does not, like TopLink, have support for conforming query results in-memory. It does also not have support for something like a savepoint where the changes up till the current point in the transaction is actually stored in the database without the transaction being commited. This would allow the query results to be conformed automatically by the database. I guess savepoint would also be the most efficient way of supporting such a feature - at least if there were support to actually only store modifications that are relevant to the query you've about to execute. In TopLink this is often not very efficient, since it is very hard upfront knowing how to store the changes to efficiently sync the database result with the inmemory-result. Does ObjectBridge have support for conforming queries either in-memory or in the database via savepoints? All the best, Geir O. |
From: Mahler T. <tho...@it...> - 2001-08-10 06:41:51
|
Hi Dirk, > -----Urspr=FCngliche Nachricht----- > Von: Dirk Olmes [mailto:di...@xa...] > Gesendet: Freitag, 10. August 2001 06:55 > An: David Forslund > Cc: obj...@li... > Betreff: Re: [Objectbridge-developers] optional relationships >=20 >=20 > David Forslund wrote: >=20 > > > To illustrate things better I'll just give a short=20 > description of my > > > tables: I have a table 'Person' which has a to-many=20 > relationship to > > > the table 'Folder'. The 'Folder' table will later have a = reflexive > > > relationship to itself (so I can have subfolders to every = folder). > > > (BTW: is that possible with ObjectBridge right now?) > >=20 > > Yes, it does. We are using it this way now. One of my=20 > applications > > has the same structure. It has an "Identity: object which=20 > contains many > > "Traits" Traits can contain other Traits. I have two=20 > tables Identity and Trait > [...] > > > In order to model that, the 'Folder' table needs a=20 > foreign key which > > > can be NULL for the case that a folder has no parent folder. > >=20 > > In my case I don't allow for a Trait to exist by itself, so a Trait > > has a Trait or an Identity as a parent. I don't formally=20 > use a foreign key. >=20 > Good to hear that. But how do you do the mapping? I currently have no > idea how to accomplish that without a foreign key. Or do you put code > into Trait to retrieve the parent? >=20 There is sample code for reflexive Joins in package test.ojb.broker = have a look at classes Tree and TreeGroup and there respective mappings. The Junit test for this resides in class TreeTest. You will see that the root nodes of the trees don't have entries for a parentId while the child nodes have. You find the respective mappings in the repository.xml file. I don't see how the formal usage of a foreign key in the database = schema could cause problems?! HTH Thomas > -dirk >=20 > _______________________________________________ > Objectbridge-developers mailing list > Obj...@li... > http://lists.sourceforge.net/lists/listinfo/objectbridge-developers >=20 |