• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why I am getting warning information like:Reverting the lazy loading on OneToMany or ManyToOne (jpa)

 
rasmita Patra
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,

Please help me in this. I am getting a warning while running the maven project.
The warning is like this: [EL Info]: 2014-09-05 14:39:29.444--ServerSession(2111097532)--EclipseLink, version: Eclipse Persistence Services - 2.4.0.v20120608-r11652
[EL Warning]: metadata: 2014-09-05 14:39:29.484--ServerSession(2111097532)--Reverting the lazy setting on the OneToOne or ManyToOne attribute [gdutypeId] for the entity class [class com.model.Gdu] since weaving was not enabled or did not occur.

Gdu.java
----------
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package com.model;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


@Entity
@Table(name = "GDU")
@NamedQueries({
@NamedQuery(name = "Gdu.findAll", query = "SELECT g FROM Gdu g"),
@NamedQuery(name = "Gdu.findByGduId", query = "SELECT g FROM Gdu g WHERE g.gduId = :gduId"),
@NamedQuery(name = "Gdu.findByName", query = "SELECT g FROM Gdu g WHERE g.name = :name"),
@NamedQuery(name = "Gdu.findByHttpPort", query = "SELECT g FROM Gdu g WHERE g.httpPort = :httpPort"),
@NamedQuery(name = "Gdu.findByModbusPort", query = "SELECT g FROM Gdu g WHERE g.modbusPort = :modbusPort")})
@SequenceGenerator(name="SEQ5", sequenceName="gduSeq", allocationSize=1)
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@gduId")
public class Gdu implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ5")
@Basic(optional = false)
@NotNull
@Column(name = "GDU_ID")
private BigDecimal gduId;
@Size(max = 10)
@Column(name = "NAME")
private String name;
@Basic(optional = false)
@NotNull
@Column(name = "HTTP_PORT")
private BigInteger httpPort;
@Basic(optional = false)
@NotNull
@Column(name = "MODBUS_PORT")
private BigInteger modbusPort;
@JoinColumn(name = "PLANT_ID", referencedColumnName = "PLANT_ID")
@ManyToOne(optional = false, fetch = FetchType.LAZY)
private Plant plantId;
@OneToMany(mappedBy = "gduId", fetch = FetchType.LAZY)
private Collection<Inverter> inverterCollection;
@JoinColumn(name = "GDUTYPE_ID", referencedColumnName = "GDUTYPE_ID")
@ManyToOne(optional = false,fetch = FetchType.LAZY)
private Gdutype gdutypeId;

public Gdu() {
}

public Gdu(BigDecimal gduId) {
this.gduId = gduId;
}

public Gdu(BigDecimal gduId, BigInteger httpPort, BigInteger modbusPort) {
this.gduId = gduId;
this.httpPort = httpPort;
this.modbusPort = modbusPort;
}

public BigDecimal getGduId() {
return gduId;
}

public void setGduId(BigDecimal gduId) {
this.gduId = gduId;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public BigInteger getHttpPort() {
return httpPort;
}

public void setHttpPort(BigInteger httpPort) {
this.httpPort = httpPort;
}

public BigInteger getModbusPort() {
return modbusPort;
}

public void setModbusPort(BigInteger modbusPort) {
this.modbusPort = modbusPort;
}

public Plant getPlantId() {
return plantId;
}

public void setPlantId(Plant plantId) {
this.plantId = plantId;
}

public Collection<Inverter> getInverterCollection() {
return inverterCollection;
}

public void setInverterCollection(Collection<Inverter> inverterCollection) {
this.inverterCollection = inverterCollection;
}

public Gdutype getGdutypeId() {
return gdutypeId;
}

public void setGdutypeId(Gdutype gdutypeId) {
this.gdutypeId = gdutypeId;
}


@Override
public int hashCode() {
int hash = 0;
hash += (gduId != null ? gduId.hashCode() : 0);
return hash;
}

@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Gdu)) {
return false;
}
Gdu other = (Gdu) object;
if ((this.gduId == null && other.gduId != null) || (this.gduId != null && !this.gduId.equals(other.gduId))) {
return false;
}
return true;
}

@Override
public String toString() {
return "com.powerelectronics.freesun.model.Gdu[ gduId=" + gduId + " ]";
}

}

In pom.xml, I have added the plugins and in persistence.xml , I have already added <property name="eclipselink.weaving" value="static"/>. Still it is giving error. Please help me in this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic