Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dali-dev] Re: [wtp-dev] Get an Entity fields

Just realized this was posted to wtp-dev, posting it to dali-dev which is the more appropriate mailing list. To answer your question about documentation, there are some javadocs on the new provisional API.. We have not written more formal documentation to explain the model at a higher level, but plan to in the near future. There is some information to be found in the archives of the dali-dev mailing list, and possibly some on the newsgroup as well.

Karen

Karen Moore wrote:

Hi Milen,

There have definitely been significant changes, hopefully for the better. We have split the model up into context model and resource model. The resource model more directly reflects the resource (java, xml). In the xml this is a generated EMF model that uses the WTP translator framework to read/write the xml. In the java it represents the annotations on the Types and Attributes. The context model pulls together the persistence.xml, orm.xml and java resource models and uses common API. It gives context to the java annotations, so that a JavaResourcePersistentType in the resource model with Entity, Table, SecondaryTable annotations on it becomes a PersistentType with an Entity TypeMapping in the context model. The context model interfaces are used by the UI. Given that information are you looking for the resource model fields, or the context model fields? I will show the api to traverse the context model.

JpaProject.getRootContext() : JpaRootContextNode
JpaRootContextNode.getPersistenceXml(): PersistenceXml
PersistenceXml.getPersistence() : Persistence
Persistence.persistenceUnits() : ListIterator<PersistenceUnit> (will contain 0 or 1 PersistenceUnits, we don't support multiple yet) PersistenceUnit.classRefs() : ListIterator<ClassRef> (mappingFileRefs() if you want the orm.xml entities)
ClassRef.getJavaPersistentType() : JavaPersistentType
JavaPersistentType.attributes() : ListIterator<JavaPersistentAttribute>


That gives you access to all the JavaPersistentAttributes in your Java entities. If you want the resource model you can call JavaPersistentAttribute.getResourcePersistentAttribute(). If you need more help than that, you could show me the code your were using before, then I could determine whether you can achieve this solely with the context model interfaces, or if you really need the resource model. I hope this helps clear things up some.

thanks,
Karen

Manov, Milen wrote:

Hello,
I've noticed that JPA API is changed significantly and I need some help to get a list of an Entity fields. I have created a JpaFile instance and get its JavaRsourceModel but from that point I am in a loss. Please help.
Kind Regards,
Milen

------------------------------------------------------------------------

_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev
_______________________________________________
wtp-dev mailing list
wtp-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-dev



Back to the top