I am trying to map my company's business objects (xml not annotation), which have the following general structure:
ObjectDetail (main table)
ObjectSummary (main table)
objectId
otherStuffInMainTable
otherStuffInOtherTables
I know how to map the Summary with a simple Id, and I know how to map the Summary object as a component of the Detail object, but开发者_如何学Python I'm not sure how to tell the Detail object that its Id is in a component. There's a lot of information in the Hib Docs about embeddable Ids, but it's all about multi-column keys. I have a simple Id, but I don't want to use the syntax they suggest because just the Id in Summary is the table key, not the whole Summary object.
Is there any best-practice for this that I'm just missing, or any good ideas out there?
If the ObjectSummary.objectId
is also the id for ObjectDetail
, they should be mapped to a single table. In this case, ObjectSummary
can't be a an entity, with a "life cycle" that is independent from ObjectDetail
.
You can mark ObjectSummary
as an embeddable entity. ObjectDetail
will have a property embedding ObjectSummary
. Check the documentation for the section about embeddable objects.
精彩评论