まず、長い投稿のためのお話、私はできるだけそれをカットしようとしました。JPAはオブジェクトを永続させるときにフィールドを逃します
JPAを使用してオブジェクトを永続化しようとしています。ほとんどのオブジェクトフィールドは永続化されますが、完全にスキップされますが、エラーはスローされません。
つまり、私はListedItemDetail
のインスタンスを永続化しようとしています。残念ながら、BidCollection
フィールドは完全に無視されており、データベースにそのフィールドのトレースはありません。理由はわかりません。
私はrelaventソースを含めました。ソースはサードパーティのスキーマから生成されました。私はJPAマッピングのためにorm.xmlを使用しており、以下のreaventビットも含めています。
public class ListedItemDetail extends Item implements Serializable{
protected BidCollection bids;
}
public class Item extends ExtensibleDataObject implements Serializable {
protected int listingId;
}
public class BidCollection extends PagedCollectionOfBidte0R55Be implements
Serializable{
private final static long serialVersionUID = 1L;
}
public class PagedCollectionOfBidte0R55Be implements Serializable {
private final static long serialVersionUID = 1L;
protected Integer totalCount;
protected Integer page;
protected Integer pageSize;
protected InnerCollectionOfBidte0R55Be list;
}
public class InnerCollectionOfBidte0R55Be implements Serializable {
private final static long serialVersionUID = 1L;
protected List<Bid> bid;
}
public class Bid extends ExtensibleDataObject implements Serializable {
private final static long serialVersionUID = 1L;
protected String account;
protected Boolean isByMobile;
protected Boolean isByProxy;
protected Timestamp bidDate;
protected Boolean isBuyNow;
protected Member bidder;
}
orm.xml:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings version="2.0">
<entity class="nz.co.trademe.api.v1.ListedItemDetail">
<attributes>
<cascade>
<cascade-persist/>
</cascade>
<embedded name="bids">
</embedded>
</attributes>
</entity>
<entity class="nz.co.trademe.api.v1.Item">
<inheritance strategy="JOINED"/>
<discriminator-column discriminator-type="STRING"/>
<attributes>
<id name="listingId">
</id>
</attributes>
</entity>
<embeddable class="nz.co.trademe.api.v1.PagedCollectionOfBidte0R55Be">
</embeddable>
<embeddable class="nz.co.trademe.api.v1.InnerCollectionOfBidte0R55Be">
<attributes>
<element-collection name="bid">
</element-collection>
</attributes>
</embeddable>
<embeddable class="nz.co.trademe.api.v1.Bid">
</embeddable>
<embeddable class="nz.co.trademe.api.v1.BidCollection">
</embeddable>
</entity-mappings>
モデルが畳み込まれています。サードパーティAPIのスキーマが原因です。ご回答有難うございます;それは私に多くの時間を節約しました。 – Kevin