Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dali-dev] quickly getting a list of Entites

Hi guys,

I know this was sort of brought up before, but this is a bit of a variant :) I am interested in (quickly) getting a list of available Entities in a Project.

I am currently using:
JpaModelManager.instance().getFilledJpaProject(project)

And then asking the JPAProject for all of its entity types. The issue here is that calling this method can take a very long time to complete the first time it is called, even for a small number of entities (I have 3 in my project).

Since I am only interested in displaying available Entities and am not concerned with all of the model elements being initialized, I thought an alternative might be to avoid filling the entire JPAProject model, and instead get the list of entities from the persistence.xml's list of classes. I tried this:

IJpaProject jpaProject = JpaModelManager.instance().getJpaProject(project);

Collection<IJpaFile> persistenceXmlFiles = jpaProject.jpaFiles(PersistenceXmlJpaFileContentProvider.INSTANCE.contentType());

But I run into the problem that persistenceXmlFiles comes back as empty when I first call it (because the model is being updated in the background I assume). So my question is: is there any way I can get the persistence.xml's list of classes without having to have the entire JPA Model initialized? Or is there some way I can speed up the "filling" of the JPAModel (for example, not checking for entities not specified in the persistence.xml)?

Thanks
Tom


Back to the top