You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Thomas Pöschmann <t....@exxcellent.de> on 2003/05/09 18:00:43 UTC

Mapping of objects without identity

Hi there,

I need to map certain database fields into a Java object without an identity. 
This Java object has to belong to a surrounding "master" object with an 
identity.

It looks like this:

CREATE TABLE PERSON (
  ID INTEGER NOT NULL PRIMARY KEY,
  DATE1 DATE,
  DATE2 DATE)

class Person {

  int id;
  Dates dates;

}

class Dates {

  Date date1;
  Date date2;

}

I know I can do that with OJB persistence callbacks, but can I define it in
the mapping somehow?

Thanks!

Thomas
-- 

   Thomas Pöschmann
   Software Architect

___ |X________________aktuell____________________________________
   X|
Vom 13. bis 15. Mai finden Sie uns als Aussteller
auf der JAX2003 in Frankfurt-Mörfelden


eXXcellent solutions gmbh
In der Wanne 55

D-89075 Ulm

e | t.poeschmann@exxcellent.de
t | +49 [0]731-55026 -0
f | +49 [0]731-55026 -99
i | http://www.exxcellent.de


_________________________________________________________________

Geschäftsführer: Dr. Martina Maier, Wilhelm Zorn, Gerhard Gruber
Sitz der Gesellschaft: Ulm, Registergericht: Ulm HRB 4309


Re: Mapping of objects without identity

Posted by Thomas Pöschmann <t....@exxcellent.de>.
Hi Rice,

>   You may use nested fields to have DATE1 mapped to
> dates->date1 and DATE2 mapped to dates->date2. 

This sound like a solution for my problem - I will try it out ASAP.

Thanks!

Thomas


how to check, if ojb finds repository.xml

Posted by Joerg Lensing <in...@softcon-lensing.de>.
hi,
how can i check, if repository.xml is found by ojb?
PersistenceBrokerFactoryDefaultImpl.buildDefaultKey() says:
<    No 'default' jdbc-connection-descriptor defined, you could not use 
the 'defaultPersistenceBroker()' method <

I changed from pure-PersistenceBroker to ODMG/Persistencebroker and the 
startup fails.
what i did already
- repository_database.xml:
  <jdbc-connection-descriptor
           jcd-alias="default"
           default-connection="true"
           platform="MySQL"
           jdbc-level="2.0"
           driver="com.mysql.jdbc.Driver"
           protocol="jdbc"
           subprotocol="mysql"
           dbalias="//localhost:3306/wecodb"
           username="myName"
           password="xxx"
        eager-release="false"
           batch-mode="false"
        useAutoCommit="1"
        ignoreAutoCommitExceptions="false"
     >
- call from WebApp-init:
        Implementation odmg = OJB.getInstance(); [here: see message from 
above]

what am i doing wrong?





Re: Mapping of objects without identity

Posted by Rice Yeh <ri...@yahoo.com>.
Hi,
  You may use nested fields to have DATE1 mapped to
dates->date1 and DATE2 mapped to dates->date2. You can
find more information for nested fields mapping by
searching key words "nested" or "embedded" in mailing
list archive.

Regards,
Rice


--- Thomas P&#39113;chmann
<t....@exxcellent.de> wrote:
> Hi there,
> 
> I need to map certain database fields into a Java
> object without an identity.
> This Java object has to belong to a surrounding
> "master" object with an
> identity.
> 
> It looks like this:
> 
> CREATE TABLE PERSON (
>   ID INTEGER NOT NULL PRIMARY KEY,
>   DATE1 DATE,
>   DATE2 DATE)
> 
> class Person {
> 
>   int id;
>   Dates dates;
> 
> }
> 
> class Dates {
> 
>   Date date1;
>   Date date2;
> 
> }
> 
> I know I can do that with OJB persistence callbacks,
> but can I define it in
> the mapping somehow?
> 
> Thanks!
> 
> Thomas
> --
> 
>    Thomas P&#39113;chmann
>    Software Architect
> 
> ___
>
|X________________aktuell____________________________________
>    X|
> Vom 13. bis 15. Mai finden Sie uns als Aussteller
> auf der JAX2003 in Frankfurt-M&#39012;felden
> 
> 
> eXXcellent solutions gmbh
> In der Wanne 55
> 
> D-89075 Ulm
> 
> e | t.poeschmann@exxcellent.de
> t | +49 [0]731-55026 -0
> f | +49 [0]731-55026 -99
> i | http://www.exxcellent.de
> 
> 
>
_________________________________________________________________
> 
> Gesch&#36622;tsf&#57698;rer: Dr. Martina Maier,
Wilhelm Zorn,
> Gerhard Gruber
> Sitz der Gesellschaft: Ulm, Registergericht: Ulm HRB
> 4309
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail:
> ojb-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com