Hello,
first: I'm an absolute hibernate beginner. I'd bee searching the web for quite a while concerning this topic but haven't found an answer. I'd like to know if ithe following scenario is possible with hibernate:
I'd like to implement a service that persists an object X from my domain model. Therefore I annotate X to be persisted with hibernate. X has got a reference to a non-hibernate object Y. Within the table, only the id attribute of Y should be stored but no other attributes. The Y object should be somehow loaded when calling X.getY(). The external API has got a Method like YService.getY(yId).
Code:
@Entity
class X
@id
getId();
getString();
getNumber();
getY();
Code:
class Y // non annotated, external object
getYId();
getAttribute1();
getAttribute2();
...
Resulting table columns for X shoud look like these:
id string number yId
So I hope that anybody understoods my problem and can help me to find a solution or at least tell be if storing id attributes of external referenced objects are possible or not.
Regards
Felix