[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Virtual Metlhods | questions

Hi Gaurav,

Metadata-source we added as part of the refreshMetadata feature. It is in 2.3. It may or may not be what you are looking for.

The bottom line is that refreshMetadata is the way to throw away all the mappings for an EntityManagerFactory you have already used and have it rebuild metadate - whether metadata source, or some other mechanism is used to get the new metadata is immaterial.

If you are using an EntityManagerFactory and then changing the mappings, then using it again, you should use that API.

It is not clear to me what the issue you are seeing with oneToManyMapping.getSelectionQuery().getDescriptor() is. Can you please provide more detail?


On 24/07/2012 4:07 PM, gaurav malhotra wrote:
Hi Tom,
Yes indeed, I have session customizer which created the mappings based on the
configured meta-data.

Since I am using eclipse 2.3, I cannot use eclipselink.metadata-source? I think
its available in eclipselink 2.4

On 24-07-2012 09:37 PM, Tom Ware wrote:
The refreshMetadata call causes the whole EntityManagerFactory to
reinitialize, potentially with new metadata - basically it restarts the
bootstrapping of an EntityManagerFactory from the beginning. The main reason
we provide that method is for those that are providing an
eclipselink.metadata-source in their persistence unit setup. If you have
customizers or event listeners that customize the mappings based on data that
may change, it could also be used for that. Is that what you are using it for?

Basically, if you want the underlying mappings in an EntityManagerFactory to
change after you have used it, that is the way to do it.


On 24/07/2012 3:27 PM, Gaurav Malhotra wrote:

Hi Tom, In real application I have to make following call to make programtic relationships creation on the fly to make the things work JpaHelper.getEntityManagerFactory(<entityManager>).refreshMetadata(null);

What I found at the object building phase, the following statement always
results in the NULL for the newly creationed relationships

Hence resulted in NPE.

Please validate that
JpaHelper.getEntityManagerFactory(<entityManager>).refreshMetadata(null); is

I found the above call resulted in the increase in deployment time (which i
also expected). Is there any other API I can use?? which can decrease my
deployment time.

~Gaurav Malhotra
eclipselink-users mailing list