EclipseLink entity mapping problem when using property accessor methods?

Thanks to the person who linked to this question it helped me come up with a solution to the issue as follows.

Thanks to the person who linked to this question - it helped me come up with a solution to the issue as follows: @Entity public interface Y { void setId(Long id); @Id Long getId(); } // introduce intermediate abstract class which implements Y @Entity public abstract class X implements Y { } // make Z extends X @Entity public class Z extends X { // use targetEntity = X. Class where required // leaving this class still free to use interface Y long id; @Override public void setId(Long id) { this. Id = id; } @Override public Long getId() { return id; } }.

EclipseLink does support querying and relationships to interfaces, but not currently in annotations. To map the interface you can use a SessionCustomizer. Public class MyCustomizer implements SessionCustomizer { public void customize(Session session) { RelationalDescriptor descriptor = new RelationalDescriptor(); descriptor.

SetJavaInterface(Y. Class); descriptor. SetAlias("Y"); session.

AddDescriptor(descriptor); } } Mapping the interface allows querying on the interface which returns any of its subclasses, and defining relationships to the interface. If the interface is used through the @VariableOneToOne annotation it will be automatically mapped.

Thanks, this looks promising - please elaborate on the "If the interface is used through the @VariableOneToOne annotation it will automatically be mapped" – loudsight Jul 21 at 19:07 A @VariableOneToOne mapping maps a reference to an interface that has multiple heterogeneous implementers. If you have one defined it takes care of registering the descriptor for the interface, so you don't need to use a customizer. – James Jul 26 at 13:13.

You cannot annotate or query on an inferface. You can only query @Entity classes, and these can only be placed on real classes, not interfaces. Use the @MappedSuperclass annotation for inheritance.

See these: download.oracle.com/javaee/6/tutorial/do... and JPA doesn't support interfaces well..implications?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions