Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] How to save a specific instance of an Entity

By definition an Entity has an identity. (i.e. one instance of an Entity can exist with a @Id) As a result any reference to an entity will have to join tables.

It sounds more like you want your service definition to be an Embeddable. If it were an Embeddable, the Entity that contained it would own it and you would not need a reference.


RogerV wrote:

I've got two entities. @Entity ServiceDefinition which comprises parameters
that control the flow of a program to perform a service. Because the
execution of the service can fail, I have my second entity @Entity public class ServiceTransaction {

private ServiceDefinition serviceDefinition;

.. getters/setters

What I want to store in ServiceTransaction is not a pointer to the
definition held in @Entity ServiceDefinition but the specific instance of
ServiceDefinition that I'm using (because ServiceDefinition could change).
In addition I would like to store the instance as an object rather than as a
collection of data elements so that I can restore its state. At runtime
Eclipselink is complaining that I don't have join details defined between
ServiceTransaction and ServiceDefinition.

Is it possible to do what I want, and if so, how?


Back to the top