Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] OneToOne AND ManyToOne Mapping works with FetchType.EAGER but not with FetchType.LAZY -> Exception when deploying (SGES 2.1)

When you say "The application did never deploy", do you mean you cannot get the application to deploy at all? (i.e. There is no set of mappings that allow the application to deploy.) In that case, the issue with LAZY is likely just a side effect of something greater. If there is a way you can successfully deploy the application, ideally, you could identify one mapping that when changed from EAGER to LAZY causes the failure and post how that mapping is defined.

Please post the full definitions

- I assume "[...]" is not the actual value for mappedby
- Include the cooresponding variable declarations
- If you are using PROPERTY access, include the cooresponding getter/setter declarations
- Include the same information about the "mapped by" mapping.
- Include the class declaration along with any annotations on the class declaration for all mappings you include


All of these things are important in creating the metadata for your application.

Also, if possible, set your logging level to FINEST and post the full log.

In other posts Mitesh Meswani provided some suggestions as well.

-Tom

zebhed wrote:
Tom,
I made some tests according to your proposition. I have tested every
OneToOne and every ManyToOne mapping affected by the issue separately by
changing the FetchType to LAZY (again). The application did never deploy.

---------

Afterwards, I have taken all my OneToOne and all my ManyToOne mappings and
put them in the list below.

---------


A) mappings that work ONLY with FetchType.EAGER:


A1.)
@OneToOne(mappedBy = "[...]", cascade = CascadeType.ALL, fetch =
FetchType.EAGER)

A2.)
@OneToOne(optional = false, mappedBy = "user", cascade = CascadeType.ALL,
fetch = FetchType.EAGER)

A3.)
@OneToOne(optional = false, cascade = CascadeType.ALL, fetch =
FetchType.EAGER)
@JoinColumn(name = "[...]", referencedColumnName = "_id", nullable = false,
unique = true, updatable = false)

A4.)
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "[...]", referencedColumnName = "_id", unique = true,
updatable = false)

A5.)
@OneToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST,
CascadeType.REFRESH}, fetch = FetchType.EAGER) @JoinColumn(name = "[...]", referencedColumnName = "_id", updatable = false)

A6.)
@ManyToOne(optional = false, fetch = FetchType.EAGER)
@JoinColumn(name = "[...]", referencedColumnName = "_id", nullable = false,
updatable = false)

A7.)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "[...]", referencedColumnName = "_id")

A8.)
@ManyToOne(optional = false, cascade = {CascadeType.MERGE,
CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.EAGER)
@JoinColumn(name = "[...]", referencedColumnName = "_id", nullable = false,
updatable = false)

---------


B) mappings that work with FetchType.LAZY:


B1.) @OneToOne(cascade = CascadeType.ALL, optional = false, fetch =
FetchType.LAZY)
@JoinColumn(name = "[...]", referencedColumnName = "_id", nullable = false)

B2.) @ManyToOne(optional = false, fetch = FetchType.LAZY)
@JoinColumn(name = "[...]", referencedColumnName = "_id", nullable = false,
updatable = false)

B3.) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "[...]", referencedColumnName = "_id")

B4.) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "[...]", referencedColumnName = "_id", nullable = false,
updatable = false)

---------


It is very unlikely that ONLY the JPA mappings themselves are causing this
issue.
Proof:
A7.) is identical to B3.)
A6.) is identical to B2.)


--------

story continues ...



Back to the top