You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by carmelk <ca...@il.ibm.com> on 2010/11/21 12:46:40 UTC

Using entity beans created by the ReverseMappingTool

Hi,

I have used the ReverseMappingTool to create a bunch of entity beans from a
given DB.
I would like now to operate on them (e.g., read, update).
Since this classes were generated automatically, is seems awkward to list
them in
persistence.xml under '<class>', doesn't it?
Does someone know of any elegant way to make openJPA familiar with classes
created by the
ReverseMappingTool ? maybe the generated orm.xml can somehow help?

Many thanks in advance,
Carmel.
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5759987.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by carmelk <ca...@il.ibm.com>.
right. got you :-)
thanks much.
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5781110.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by Michael Dick <mi...@gmail.com>.
Hi,

The entities found in orm.xml do not need to be listed in persistence.xml,
OpenJPA will automatically consider them part of the persistence unit.

If you have other entities, defined via annotations and want to include them
in your persistence unit you'll need to list them in the <class> tags, and
they'll be merged with the ones found in orm.xml.

Hope this helps,
-mike


On Sun, Nov 21, 2010 at 5:46 AM, carmelk <ca...@il.ibm.com> wrote:

>
> Hi,
>
> I have used the ReverseMappingTool to create a bunch of entity beans from a
> given DB.
> I would like now to operate on them (e.g., read, update).
> Since this classes were generated automatically, is seems awkward to list
> them in
> persistence.xml under '<class>', doesn't it?
> Does someone know of any elegant way to make openJPA familiar with classes
> created by the
> ReverseMappingTool ? maybe the generated orm.xml can somehow help?
>
> Many thanks in advance,
> Carmel.
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5759987.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: Using entity beans created by the ReverseMappingTool

Posted by venra <sv...@hotmail.com>.
Thanks Mike.
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5896345.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by Michael Dick <mi...@gmail.com>.
There's a little more information in the OpenJPA manual
here<http://openjpa.apache.org/builds/apache-openjpa-2.0.2-SNAPSHOT/docs/manual/manual.html#ref_guide_pc_reverse>.
It sounds like you've made some progress, but the link might help if you
have any questions, or if anyone else hits similar issues.

Hope this helps,
-mike


On Mon, Dec 27, 2010 at 1:10 PM, venra <sv...@hotmail.com> wrote:

>
> Thanks Carmel.
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5869623.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: Using entity beans created by the ReverseMappingTool

Posted by venra <sv...@hotmail.com>.
Thanks Carmel.
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5869623.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by carmelk <ca...@il.ibm.com>.
Hi,

I don't have any specific documentation, mainly trial & error :-)
Regarding orm.xml - it is being generated as well with the same tool.

Carmel.
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5867613.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by venra <sv...@hotmail.com>.
Thanks for your reply Carmel. I really appreciate it. If you could provide
the customizer.properties file that would be really helpful. thanks in
advance. 

Also i have a question, can we generate orm.xml file? Where can find the
detail documentation about Reversemappingtool. If you have any link, please
forward me that. Thanks again.

Thanks,
-Venra

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5862183.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by venra <sv...@hotmail.com>.
Thanks for your reply Carmel. I really appreciate it. If you could provide
the customizer.properties file that would be really helpful. thanks in
advance. 

Also i have a question, can we generate orm.xml file? 

Thanks,
-Venra

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5862182.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by carmelk <ca...@il.ibm.com>.
Hi,

Here is a sample of how I used it:

			ReverseMappingTool.main(new String[] {
					"-connectionURL",  "jdbc:mysql://" + host +" ":3306/" + dbname +
"?user=" + user + "t&password=" + passw0rd;
					"-connectionDriverName", "com.mysql.jdbc.Driver",
					//package
					"-pkg", packageName,
					//source dir
					"-directory", srcDir,
			//customizer
			"-cp", "conf/customizer.properties",
			//annotations
			"-annotations", "true" 
					});

In my case the database didn't have explicit foreign keys, so I didn't use
this option, but I think there should be some support for this.

Carmel.

-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5794830.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Using entity beans created by the ReverseMappingTool

Posted by venra <sv...@hotmail.com>.
Hi Carmel,

I would like to use the Reversemappling tool but i am getting errors. if you
could provide me the procedure and if possible sample code, would be really
appreciated. Also i would like to know, will that create relations between
the tables also in the java classes (like onetomany, manytoone)?
-- 
View this message in context: http://openjpa.208410.n2.nabble.com/Using-entity-beans-created-by-the-ReverseMappingTool-tp5759987p5793607.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.