Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Load mapping file at "runtime"

Den 05.10.2010 17:35, skrev Tom Ware:
Hi Christian,

Is it possible to have multiple persitence units that have the same
entities, but different orm xml files that override the mappings and
just select the persistence unit that has the override you need.

It is possible to alter the underlying EclipseLink metadata after your
peristence unit is created, but you need to be careful because there is
quite alot of code that runs at initialization time to make sure
everything is consistence. Changing the field a BasicMapping maps to
should be fairlyl easy, but if you get into changing relationships
mappings or mappings within InheritanceHierarchies, you will have to be
quite careful.

org.eclipse.persistence.jpa.JpaHelper has a getServerSession() method
that can get our underlying session. Session has a project and project
has a list of mappings that can be acquired by name. Changing the
mappings is a matter of calling the appropriate methods on the various
mappings you get back.


Thank you :-)
+1 beer for you.

--
Kind regards
Christian Michelsen


Back to the top