RE: [ojb-users] mapping multiple objects transparently to a singl e table
Brought to you by:
thma
From: Matthew b. <mat...@ya...> - 2002-06-18 05:43:53
|
Close. In order to make sequence generators work for all cases, I needed to change the behaviour to be unique to the table that the class is mapped to, and not the class itself as multiple classes can be mapped to one table. Sequence generators will work normally for this situation now. m Arvind Gudipati <Arv...@PA...> wrote: Im pretty new to OJB myself.. but i will try to answer yr question (experts please correct me if im wrong!!) OJB uses a special sequence tables to create the unique id's for each class. This default behaviour can be changed.. If you want to store/insert 2 classes to one table, you's have to change the default sequence generation mechanism... However the problem comes when you want to retrive the data.. how does OJB knows which class to instantiate for what? There is also a way for OJB to specify the same.... but this requires modification of your database table by adding a special column .... take a look at examples in test directory of OJB distribution... class test.A test.AB and test.B are all stored in one table AB_TABLE ... but this is an example of inheritence... however i think it can also be used in situations elsewhere as yours... Hope this solves your problem... Arvind -----Original Message----- From: Matthew baird [mailto:mat...@ya...] Sent: Friday, June 14, 2002 5:54 PM To: Andrew Geery; 'obj...@li...' Subject: Re: [ojb-users] mapping multiple objects transparently to a single table I don't have the answer offhand (I'm probably the most responsible for multiple objects mapped to a single table right now), but I'll get around to writing a test case for it soon, unless of course you want to write one for me. Once the test case is done, I'll look at fixing it. I'll fix it faster if I have the test case done sooner... hint hint. m Andrew Geery <Gee...@do...> wrote: I was wondering if it is possible to map multiple objects to a single table transparently. For example: Object A maps to table T. Object B contains a reference to object A and also maps to table T. How can I set up the repository.xml file so that when I call broker.store( B ); object A is also stored? The problem I am running into is that the database complains that the id column is specfied more than once in the INSERT statement Can this even be done? If it can, a short example would be wonderful. Thanks Andrew _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas - http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users --------------------------------- Do You Yahoo!? Sign-up for Video Highlights of 2002 FIFA World Cup ***************************************************************************************** This E-mail is from PANACYA Inc. The E-mail and any files transmitted with it are confidential and may also be privileged and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorized direct or indirect dissemination, distribution or copying of this message and any attachments is strictly prohibited. If you have received the E-mail in error please notify adm...@pa... or telephone (410) 910-3300. **************************************************************************************** --------------------------------- Do You Yahoo!? Sign-up for Video Highlights of 2002 FIFA World Cup |