[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.dali] Re: Project without annotaions in the model classes

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