[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[dali-dev] Dali 2.0 - how do I retrieve default OrmXml?
|
Hi there,
One more question along these lines -- sorry ;)
In the snippet you sent, the OrmXml is being retrieved via:
for (Iterator<MappingFileRef> mappingFiles =
persistenceUnit.mappingFileRefs(); mappingFiles.hasNext();) {
But that seems to only retrieve mapping files explicitly listed in the
persistence.xml. By default, the orm.xml is not listed there. Should
the default /META-INF/orm.xml be being returned via the API in this case
as well, since it does not need to be specified in the persistence.xml?
Or is there another mechanism to get the default OrmXml model?
Thanks
Tom
Tom Mutdosch wrote:
Hi Karen,
I tried the getEntities() code snippet that you had sent me, and it
works mostly but does not do exactly what I expected. That seems to
only retrieve entities that are listed directly in the persistence.xml
file, and not annotated Java entities that aren't explicitly listed.
We actually discovered this due to an apparent timing bug where
immediately after the Generate Entities wizard was run we called our
getEntities() method and it was not returning the new entity classes.
(Aside: it looks like there's a separate timing issue here where the
entities were not yet updated in the persistence.xml; Is the
synchronizeClasses run as a separate Job after GenerateEntities?)
In any case, is there a way to do a similar getEntities() call that
gets entities from the Dali model whether they are listed in the
persistence.xml or not? It looks like calling
jpaProject.annotatedClasses() returns all of the entities as ITypes,
so it seems they are stored in the model somehow - I'm just not sure
how to appropriately get all of the PersistentTypes.
Thanks
Tom
Karen Moore wrote:
I agree, the code to get a list of entities is a bit convoluted and
difficult to find. We've had other adopters ask us for this as well,
so documentation on the existing API or helper API is the way to go.
Thanks for your feedback!
Karen
Tom Mutdosch wrote:
Hi Karen,
Thanks for the details; I definitely understand all the complexities
in providing various API to suit every possible need. I have no
problem writing a getEntities() method myself. The main reason I
suggested it was that it wasn't totally obvious how to do that using
the existing APIs. I figured others might have the same
difficulties, so a new API call could address that. But having
documentation or examples of how to do some of these common
operations would probably help achieve the same effect, so maybe
it's not a big deal.
Regarding saving the OrmXML and PersistenceXML models, thanks for
the code snippets - that's what I was looking for. I opened an
enhancement request with my particular usecase:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=223197
Thanks again,
Tom
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev