Hi,
i am getting this and because i have some severe performance problems
with our OpenJPA based app, i wanted to ask for help:
[INFO 02:06:25] Log4JLogFactory$LogAdapter.info(80) | Inefficient
mapping: You have declared that field
"de.logentis.bwh.model.RetourePosition.retoure" is mapped by
collection "de.logentis.bwh.model.Retoure.retourePositionList". The
mapping would be much more efficient if instead you map
"de.logentis.bwh.model.RetourePosition.retoure" and declare that
"de.logentis.bwh.model.Retoure.retourePositionList" is mapped by it.
My domain model:
@Entity
@Table(name = "retoure")
@VersionColumn(name = "_version")
public class Retoure {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "oid")
long oid;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@ElementJoinColumn(name = "retoure_oid", referencedColumnName =
"oid")
List<RetourePosition> retourePositionList;
---
@Entity
@VersionColumn(name = "_version")
@Table(name = "retourepos")
public class RetourePosition {
@Id
@Column(name = "oid")
@GeneratedValue(strategy = GenerationType.IDENTITY)
long oid;
@OneToOne(mappedBy = "retourePositionList", cascade =
CascadeType.REFRESH, fetch = FetchType.EAGER)
Retoure retoure;
---
Table Info: "retoure_oid" is a foreign key field in the "retourepos"
table that points to the "oid" field of the "retoure" table.
To me this looks like a good way but the warning says something else.
I tried to change the mapping so that the actual mapping will be done
in "retoure" atrtribute and just do a "mappedBy" reference on
"retourePositionList" but then it wont work at all. When i read the
warning, i would exactly expect that this would work. So what am i
doing wrong here?
---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de