Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » Project without annotaions in the model classes
Project without annotaions in the model classes [message #435471] Sun, 15 March 2009 22:17 Go to next message
Heiko Ahlig is currently offline Heiko AhligFriend
Messages: 62
Registered: July 2009
Member
Is it possible to create a JPA project and a mapping without annotions
in the model classes and only in the persistence or eclipselink-orm.xml
file?
When yes, which swith / option I have to use for this?

thanks in advance

Heiko
Re: Project without annotaions in the model classes [message #435472 is a reply to message #435471] Mon, 16 March 2009 17:40 Go to previous messageGo to next message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
> Is it possible to create a JPA project and a mapping without annotions
> in the model classes and only in the persistence or eclipselink-orm.xml
> file?
> When yes, which swith / option I have to use for this?

Yes, it is possible to edit your mappings via the orm.xml or
eclipselink-orm.xml instead of using annotations. Dali does not yet
support entity generation into an orm.xml file, only annotations. But you
can create a new eclipselink-orm.xml file (choose New -> EclipseLink
Mapping File) and then open it in the JPA perspective and you will notice
the JPA details view and JPA structure view. In the JPA structure view
just right click on the Entity Mappings and choose to 'Add class...'.
Then you can edit all of the mapping information using the JPA
details/structure views. You will see all of the attribute mapping
defaults from the java in the structure view. You can right-click on
these add them to the xml and then edit them in the JPA details view.
Hope this helps!

Karen
Re: Project without annotaions in the model classes [message #435497 is a reply to message #435472] Tue, 17 March 2009 22:26 Go to previous messageGo to next message
Heiko Ahlig is currently offline Heiko AhligFriend
Messages: 62
Registered: July 2009
Member
Hi Karen,
thanks for your answer, today I found out your answer by myself while
playing with the framework, and some minutes later I see your answer. :)

But now I have the next problems.
- First, if I use the eclipselink-orm.xml instead of the standard
orm-xml, I get an error in eclipse. This I have reported under:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=269102

- Second, I think this is only a problem again at myself:
In my eclipse trainings and also if I show at some more complex
examples, I see that mostly the model classes are in a seperate
java-projects or plugins.

My first solution approach (doesnt work):
To try this pratice I generate a simple plugin, add here my
model-classes and export this package.
Next I generate a JPA-project, convert it to a plugin-project and import
the model-plugin.
Try to build my mapping - here I can add the classes to the orm -file
with "Add class ..." but than the orm-file shows an erre with: "class
xyz cannot be resolved" and the fields arn't visible in the
JPA-structe-view. :(
(I tryed the import with import the model-project as project and also
import the package)

My second solution approach (it works):
I generate a JPA - project, convert it into a plugin-project, build my
model - classes and mapping.
Generate an other plugin-project, where I will work with this classes
and the EclipseLink-system.
Create in this plugin my META-INF - folder and copy the persistence.xml
and orm.xml from the first plugin to this META-INF.

This work but isn't really good solution.

Exists for the also an better solution?

Thanks again,

Heiko

Am 16.03.2009 18:40, schrieb Karen Butzke:
>> Is it possible to create a JPA project and a mapping without annotions
>> in the model classes and only in the persistence or
>> eclipselink-orm.xml file?
>> When yes, which swith / option I have to use for this?
>
> Yes, it is possible to edit your mappings via the orm.xml or
> eclipselink-orm.xml instead of using annotations. Dali does not yet
> support entity generation into an orm.xml file, only annotations. But
> you can create a new eclipselink-orm.xml file (choose New -> EclipseLink
> Mapping File) and then open it in the JPA perspective and you will
> notice the JPA details view and JPA structure view. In the JPA structure
> view just right click on the Entity Mappings and choose to 'Add
> class...'. Then you can edit all of the mapping information using the
> JPA details/structure views. You will see all of the attribute mapping
> defaults from the java in the structure view. You can right-click on
> these add them to the xml and then edit them in the JPA details view.
> Hope this helps!
>
> Karen
>
Re: Project without annotaions in the model classes [message #435505 is a reply to message #435497] Fri, 20 March 2009 14:18 Go to previous message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
Heiko,

Brian is working on https://bugs.eclipse.org/258544 which is possibly
going to work for your situation. He is adding support for referencing
jars in the persistence.xml. I am not completely sure if this will cover
your use case, but it will certainly go a long way towards supporting it.
That bug will be completed for Galileo. Currently we do not support your
use case, so your workaround is the best we can do for now :)

Karen
Re: Project without annotaions in the model classes [message #614935 is a reply to message #435471] Mon, 16 March 2009 17:40 Go to previous message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
> Is it possible to create a JPA project and a mapping without annotions
> in the model classes and only in the persistence or eclipselink-orm.xml
> file?
> When yes, which swith / option I have to use for this?

Yes, it is possible to edit your mappings via the orm.xml or
eclipselink-orm.xml instead of using annotations. Dali does not yet
support entity generation into an orm.xml file, only annotations. But you
can create a new eclipselink-orm.xml file (choose New -> EclipseLink
Mapping File) and then open it in the JPA perspective and you will notice
the JPA details view and JPA structure view. In the JPA structure view
just right click on the Entity Mappings and choose to 'Add class...'.
Then you can edit all of the mapping information using the JPA
details/structure views. You will see all of the attribute mapping
defaults from the java in the structure view. You can right-click on
these add them to the xml and then edit them in the JPA details view.
Hope this helps!

Karen
Re: Project without annotaions in the model classes [message #614945 is a reply to message #435472] Tue, 17 March 2009 22:26 Go to previous message
Heiko Ahlig is currently offline Heiko AhligFriend
Messages: 62
Registered: July 2009
Member
Hi Karen,
thanks for your answer, today I found out your answer by myself while
playing with the framework, and some minutes later I see your answer. :)

But now I have the next problems.
- First, if I use the eclipselink-orm.xml instead of the standard
orm-xml, I get an error in eclipse. This I have reported under:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=269102

- Second, I think this is only a problem again at myself:
In my eclipse trainings and also if I show at some more complex
examples, I see that mostly the model classes are in a seperate
java-projects or plugins.

My first solution approach (doesnt work):
To try this pratice I generate a simple plugin, add here my
model-classes and export this package.
Next I generate a JPA-project, convert it to a plugin-project and import
the model-plugin.
Try to build my mapping - here I can add the classes to the orm -file
with "Add class ..." but than the orm-file shows an erre with: "class
xyz cannot be resolved" and the fields arn't visible in the
JPA-structe-view. :(
(I tryed the import with import the model-project as project and also
import the package)

My second solution approach (it works):
I generate a JPA - project, convert it into a plugin-project, build my
model - classes and mapping.
Generate an other plugin-project, where I will work with this classes
and the EclipseLink-system.
Create in this plugin my META-INF - folder and copy the persistence.xml
and orm.xml from the first plugin to this META-INF.

This work but isn't really good solution.

Exists for the also an better solution?

Thanks again,

Heiko

Am 16.03.2009 18:40, schrieb Karen Butzke:
>> Is it possible to create a JPA project and a mapping without annotions
>> in the model classes and only in the persistence or
>> eclipselink-orm.xml file?
>> When yes, which swith / option I have to use for this?
>
> Yes, it is possible to edit your mappings via the orm.xml or
> eclipselink-orm.xml instead of using annotations. Dali does not yet
> support entity generation into an orm.xml file, only annotations. But
> you can create a new eclipselink-orm.xml file (choose New -> EclipseLink
> Mapping File) and then open it in the JPA perspective and you will
> notice the JPA details view and JPA structure view. In the JPA structure
> view just right click on the Entity Mappings and choose to 'Add
> class...'. Then you can edit all of the mapping information using the
> JPA details/structure views. You will see all of the attribute mapping
> defaults from the java in the structure view. You can right-click on
> these add them to the xml and then edit them in the JPA details view.
> Hope this helps!
>
> Karen
>
Re: Project without annotaions in the model classes [message #615759 is a reply to message #435497] Fri, 20 March 2009 14:18 Go to previous message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
Heiko,

Brian is working on https://bugs.eclipse.org/258544 which is possibly
going to work for your situation. He is adding support for referencing
jars in the persistence.xml. I am not completely sure if this will cover
your use case, but it will certainly go a long way towards supporting it.
That bug will be completed for Galileo. Currently we do not support your
use case, so your workaround is the best we can do for now :)

Karen
Previous Topic:Dali 2.1.1 Released
Next Topic:Entity Wizard omits columns in entity if foreign key
Goto Forum:
  


Current Time: Thu Apr 25 11:07:55 GMT 2024

Powered by FUDForum. Page generated in 0.03361 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top