Manually creating persistence.xml or hbm.xml [message #622147] |
Mon, 15 February 2010 23:33 |
Lemao Messages: 48 Registered: December 2009 |
Member |
|
|
I have a somewhat large EMF model where I want to persist a subset of them using Teneo. Some of these persitent classes are somewhat independent and so easily made persistent with Teneo. However, I have a bunch of other EClasses that need to be partially persisted to the database if at all.
1) The first problem I am facing is that base EClass are considered top level entities even though their own purpose is for a proper in-memory abstraction. I am assuming that @MappedSubclass will solve this although I wasnt able to verify due to the next issue.
2) The next problem is that Teneo is, as expected, traversing all references in my model to things I dont want to persist. In some cases I dont want to persist a whole EClass and in some cases I dont want to persist a few references. Looking at the code I noticed that the top-level entity resolution takes into account the transient EMF property, but since my models are also written to files, I dont have the luxury of turning my EClasses or the specific references transient. I then came across adding @Transient annotation to EClass. After I added @Transient to all the EClasses I didnt want persisted to the db I still seems to traverse all references even though the EClasses have the @Transient annotation.
3) I then thought that a good way to do this would be to take the mappings entirely into my hands. I grabbed a dump of the mappings generated by Teneo (I had a fairly independent part of the model persisted in Teneo), set the required PersistenceOptions to read from a file instead of auto generating and then manually added the mappings for the EClasses I wanted to persist and only the attributes/references I needed. Here I got exception in the EMFTuplizer. Is this possible, i.e. craft the mapping in Hibernate HBM or JPA persistence.xml entirely by hand?
At this point I am not sure what to do and wondering if I am missing something obvious here?
Thanks in advance,
In addition, would it be possible to write my mappings directly in Hibernate hbm or JPA persistence.xml without using the mapping generation?
|
|
|
Powered by
FUDForum. Page generated in 0.02611 seconds