Hypersistence Optimizer allows you to get the most out of JPA and Hibernate. By scanning your application configuration and mappings, Hypersistence Optimizer can tell you what changes you need to do to speed up your data access layer.
I have the following message, I can't understand:
CRITICAL - OneToOneWithoutMapsIdEvent - The [fees] one-to-one association in the [InstrumentEntity] entity is using a separate Foreign Key to reference the parent record. Consider using @MapsId so that the identifier is shared with the parent row. For more info about this event, check out this User Guide link - https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#OneToOneWithoutMapsIdEvent
I try to have a unidirectional one-to-one, and maps the parent ID as the child PK.
This is my configuration:
@Entity
@Table(name = "INSTRUMENT")
public class InstrumentEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_INSTRUMENT")
@SequenceGenerator(name = "SEQ_INSTRUMENT", sequenceName = "SEQ_INSTRUMENT", allocationSize = 1)
private Long id;
@OneToOne(fetch = FetchType.LAZY, orphanRemoval = true, cascade = CascadeType.ALL)
@JoinColumn(name = "INSTRUMENT_FEE_ID")
@MapsId("ID") // Necessary because in contrary with the documentation, it's not using ID but INSTRUMENT_INSTRUMENT_FEE_ID that don't exist
private InstrumentFeeEntity fees;
}
And
@Entity
@Table(name = "INSTRUMENT_FEE")
public class InstrumentFeeEntity {
@Id
private Long id;
}
Should I miss something or is it a false positive error ?
I have the following message, I can't understand:
CRITICAL - OneToOneWithoutMapsIdEvent - The [fees] one-to-one association in the [InstrumentEntity] entity is using a separate Foreign Key to reference the parent record. Consider using @MapsId so that the identifier is shared with the parent row. For more info about this event, check out this User Guide link - https://vladmihalcea.com/hypersistence-optimizer/docs/user-guide/#OneToOneWithoutMapsIdEvent
I try to have a unidirectional one-to-one, and maps the parent ID as the child PK. This is my configuration:
And
Should I miss something or is it a false positive error ?