Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » hooks
hooks [message #990986] Sun, 16 December 2012 12:16 Go to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
I'm architecting a some what exceptional situation. In this setup the client has a "universal business model", but each of the entities may be managed by a different application, storing its data in separate databases. The business model is overlapping all applications, but part of it may be "local" and part of it may be remote.

There are many approaches to this setup; for example one could use a big event bus and synchronize many readonly copies with one writable at database level. Another approach, which I'm currently investigating, is that the BM model knows where to get things.

In this scenario there are DAO objects with persist, remove and findBy* methods, which know whether to load from a database or retrieve through REST (for example). The challenge will be to hook into relationship methods. Suppuse I have a user and want to get its groups, I would do this by calling getGroups() and the JPA annotations will result in a fetch to the database. But what if those groups are stored elsewhere and I need to issue a REST GET to get them?

Does Eclipselink go through the entity manager in order to lazy load dependencies? So we can hook into one of its methods? Or does it directly get a connection and runs the SQL?
Re: hooks [message #991523 is a reply to message #990986] Wed, 19 December 2012 16:35 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can use a QueryRedirector on any mapping to provide your own code for the query. But the relationship is not persistent, you should probably just not map it, and use your get method to perform the access.

JPA and EclipseLink also have PostLoad/PostBuild events that allow you to perform you own code.

EclipseLink also has NoSQL support, and composite persistent units. So you can have relationships that are stored in different databases.


James : Wiki : Book : Blog : Twitter
Previous Topic:Query Money/BigDecimal Datatype
Next Topic:show_sql turn off at runtime
Goto Forum:
  


Current Time: Thu Apr 25 06:22:28 GMT 2024

Powered by FUDForum. Page generated in 0.02892 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top