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 Franz-Josef Herpers <fj...@wir-age.de> on 2003/11/21 15:49:08 UTC

JDO and repository

Hi,

As with the ODMG-Implementation I'm trying now to adapt the JDO tutorial 
examples for my own application.
I successfully enhanced one class and defined a mapping in a jdo-File. 
As far as I understand I need still a repository_database.xml to specify 
my default DB-Connection. If I don't do it I get an error message that 
default is not specified.

OK, but if I specify the default connection, OJB still wants a mapping 
definition for my table-class-mapping in the repository_user.xml. But 
there is already a mapping defined in my jdo-file.

Can someone spread some light upon the relationship between the 
repository.xml-stuff and the jdo-files. The tutorial only states
"TODO: Put information about the .jdo files".


Thanks in advance
Franz





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


Re: JDO and repository

Posted by Brian McCallister <mc...@forthillcompany.com>.
.jdo files are used for bytecode enhancement. I don't think any JDO 
impl needs them at runtime, but I don't remember what the spec says.

-Brian

On Friday, November 21, 2003, at 11:25 AM, Franz-Josef Herpers wrote:

> Hi Gus,
>
> thanks for your help.
>
>> 1 You do need a repository.xml with a repository_users.xml included,  
>> a repository_database.xml and the repository_internal. The 
>> repository_user.xml is to tell the ojb mechanisms that sit behind the 
>> JDO facade what your database looks like. The repository_database.xml 
>>  specifies things like your db driver etc.
>
> I can retrieve objects from my database too now with JDO. Everything 
> is as you explain, except that I don't need the repository_internal 
> and the  internal tables in the database.
> And it seems the jdo files are not needed at runtime.
>
> In the repository_database.xml I configured my default database 
> configuration. The ODMG-tutorial says how to switch to another 
> connection. That is exactly what I need in my application. I must 
> switch between at least two databases. Any hints how to do this with 
> the JDO-Implementation?
>
> Regards
> Franz
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>
> -- 
> Franz-Josef Herpers
> Puschkinallee 9A
> 12435 Berlin
> 030/53 21 33 02
> 0173/54 23 666
> fjh@wir-age.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>



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


Re: JDO and repository

Posted by Franz-Josef Herpers <fj...@wir-age.de>.
Hi Gus,

thanks for your help.

> 1 You do need a repository.xml with a repository_users.xml included,  a 
> repository_database.xml and the repository_internal. The 
> repository_user.xml is to tell the ojb mechanisms that sit behind the 
> JDO facade what your database looks like. The repository_database.xml  
> specifies things like your db driver etc.

I can retrieve objects from my database too now with JDO. Everything is 
as you explain, except that I don't need the repository_internal and the 
  internal tables in the database.
And it seems the jdo files are not needed at runtime.

In the repository_database.xml I configured my default database 
configuration. The ODMG-tutorial says how to switch to another 
connection. That is exactly what I need in my application. I must switch 
between at least two databases. Any hints how to do this with the 
JDO-Implementation?

Regards
Franz

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

-- 
Franz-Josef Herpers
Puschkinallee 9A
12435 Berlin
030/53 21 33 02
0173/54 23 666
fjh@wir-age.de


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


Re: JDO and repository

Posted by Gus Heck <gu...@olin.edu>.
oops...

> 1 You do need a repository.xml with a repository_users.xml included,  
> a repository_database.xml that specifies things like your db driver 
> and the repository_internal to tell the ojb mechanisms that sit behind 
> the JDO facade what your database looks like.

One can see that I wasn't an english major and didn't re-read after 
editing here....

The corrected version:

1 You do need a repository.xml with a repository_users.xml included,  a 
repository_database.xml and the repository_internal. The 
repository_user.xml is to tell the ojb mechanisms that sit behind the 
JDO facade what your database looks like. The repository_database.xml  
specifies things like your db driver etc.


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


Re: JDO and repository

Posted by Gus Heck <gu...@olin.edu>.
Hi Franz,

I am in the process of trying to use the JDO API as well, though just 
beginning. I had some similar questions when I started, though I had not 
used ODMG. I have gotten it far enough that my application is now 
sending sql to the database (though it is failing due to the fact I 
havn't initialized the tables yet, but that is the expected behavior 
right now). Here are some key things I have found so far.

1 You do need a repository.xml with a repository_users.xml included,  a 
repository_database.xml that specifies things like your db driver and 
the repository_internal to tell the ojb mechanisms that sit behind the 
JDO facade what your database looks like.

2. You do need .jdo file(s) as well for your enhancer. These files *are* 
quite similar to repository-user and duplicate a lot of information.

3. Xdoclet can be used to generate both of these configuration files at 
build time. This was fairly easy and I highly reccomend it. Using 
Xdoclet will put all the information in javadoc like tags in your source 
code file, so that you only ever edit the source, rather than editing 
the source and then two xml files and hope that your edits all match.

4. The database can be initialized via Torque and a project_schema.xml 
which can also be generated by Xdoclet without any additional tags. I am 
currently pursuing a slightly more elegant solution that allows updating 
of the database in place as well, but you may not need that. See my 
recent thread titled: "Auto create tables in the DB"

Hope this helps,
Gus

Franz-Josef Herpers wrote:

> Hi,
>
> As with the ODMG-Implementation I'm trying now to adapt the JDO 
> tutorial examples for my own application.
> I successfully enhanced one class and defined a mapping in a jdo-File. 
> As far as I understand I need still a repository_database.xml to 
> specify my default DB-Connection. If I don't do it I get an error 
> message that default is not specified.
>
> OK, but if I specify the default connection, OJB still wants a mapping 
> definition for my table-class-mapping in the repository_user.xml. But 
> there is already a mapping defined in my jdo-file.
>
> Can someone spread some light upon the relationship between the 
> repository.xml-stuff and the jdo-files. The tutorial only states
> "TODO: Put information about the .jdo files".
>
>
> Thanks in advance
> Franz
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>



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