Using platform version 6.10.11.
I have an entity “AssebmledProductLot” that inherits from “ProductLot”. “ProductLot” references another entity “ProductVersion” with a Many-to-One relationship. “ProductVersion” is a composition under “Product2”.
@DiscriminatorValue("AssemProductLot")
@PrimaryKeyJoinColumn(name = "ID", referencedColumnName = "ID")
@Table(name = "DEIPRODUCTCONFIG2_ASSEMBLED_PRODUCT_LOT")
@NamePattern("%s / Lot: %s / Date: %s|productVersion,lotNumber,dateCode")
@Entity(name = "deiproductconfig2$AssembledProductLot")
public class AssembledProductLot extends ProductLot {
...
}
@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING)
@Inheritance(strategy = InheritanceType.JOINED)
@NamePattern("%s / Lot: %s / Date: %s|productVersion,lotNumber,dateCode")
@Table(name = "DEIPRODUCTCONFIG2_PRODUCT_LOT", uniqueConstraints = {
@UniqueConstraint(name = "IDX_DEIPRODUCTCONFIG2_PRODUCT_LOT_UNQ", columnNames = {"DATE_CODE", "LOT_NUMBER", "PRODUCT_VERSION_ID"})
})
@Entity(name = "deiproductconfig2$ProductLot")
public class ProductLot extends StandardEntity {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRODUCT_VERSION_ID")
protected ProductVersion productVersion;
@Column(name = "DATE_CODE", length = 100)
protected String dateCode;
@Column(name = "LOT_NUMBER", length = 50)
protected String lotNumber;
...
}
and
@NamePattern("%s-v%s|product2,versionName")
@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING)
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorValue("deiproductconfig2$ProdVer")
@Table(name = "DEIPRODUCTCONFIG2_PRODUCT_VERSION")
@Entity(name = "deiproductconfig2$ProductVersion")
public class ProductVersion extends StandardEntity {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PRODUCT2_ID")
protected Product2 product2;
@Column(name = "VERSION_NAME")
protected String versionName;
...
}
and
@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING)
@Inheritance(strategy = InheritanceType.JOINED)
@NamePattern("%s|productNumber")
@Table(name = "DEIPRODUCTCONFIG2_PRODUCT2")
@Entity(name = "deiproductconfig2$Product2")
public class Product2 extends StandardEntity {
...
@Column(name = "PRODUCT_NUMBER", length = 100)
protected String productNumber;
...
}
When I go to Entity Inspector Browse and select my “AssembledProductLot” entity, I consistently get an “unfetched attribute” exception on the “productVersion” attribute. I’ve replicated and played with the code a bit and I’ve realized that if I specify a FetchMode of “BATCH” or “JOIN” for that attribute, the exception disappears. It only appears when the FetchMode is “UNDEFINED” (also when the “AUTO” FetchMode turns into “UNDEFINED”). So here is my question: why? The parent entity “ProductLot” does not have this issue, nor does another child of “ProductLot” that I have. So I am rather confused on this.