When I try to add data to the database, the hibernate hangs on this point.
Hibernate: select next_val as id_val from hibernate_sequence for update
Hibernate: update hibernate_sequence set next_val= ? where next_val=?
Domain class
package org.jazzteam.domain.commentary;
import org.jazzteam.domain.id.Id;
import org.jazzteam.domain.event.Event;
import org.jazzteam.domain.user.SimpleUser;
import org.jazzteam.domain.user.User;
import javax.persistence.*;
/**
* #author Yura
* #version 1.0
*/
#Entity
#Table
public class Commentary extends Id {
#OneToOne(cascade = CascadeType.ALL)
private SimpleUser author;
private String description;
/*#ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Event event;*/
private int rating;
public Commentary(){
}
public Commentary(SimpleUser author, String description, Event event, int rating){
this.author = author;
this.description = description;
/*this.event = event;*/
this.rating = rating;
}
public void setAuthor(SimpleUser author) {
this.author = author;
}
public void setDescription(String description) {
this.description = description;
}
/*public void setEvent(Event event) {
this.event = event;
}*/
public void setRating(int rating) {
this.rating = rating;
}
public User getAuthor() {
return author;
}
public String getDescription() {
return description;
}
/*public Event getEvent() {
return event;
}*/
public int getRating() {
return rating;
}
}
DAO
package org.jazzteam.dao.commentary;
import org.hibernate.SessionFactory;
import org.jazzteam.domain.commentary.Commentary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by Yura on 14.04.2017.
*/
#Repository
public class CommentaryDaoImpl implements CommentaryDao<Commentary> {
#Autowired
SessionFactory sessionFactory;
#Override
public void persist(Commentary entity) {
sessionFactory.getCurrentSession().persist(entity);
}
#Override
public void update(Commentary entiry) {
sessionFactory.getCurrentSession().update(entiry);
}
#Override
public void delete(Commentary entity) {
sessionFactory.getCurrentSession().delete(entity);
}
#Override
public Commentary findById(int id) {
return sessionFactory.getCurrentSession().get(Commentary.class, id);
}
#Override
public List<Commentary> findAll() {
return sessionFactory.getCurrentSession().createQuery("from Commentary ").list();
}
}
Service class
package org.jazzteam.service.commentary;
import org.jazzteam.dao.commentary.CommentaryDao;
import org.jazzteam.domain.commentary.Commentary;
import org.jazzteam.service.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Created by Yura on 14.04.2017.
*/
#org.springframework.stereotype.Service
public class CommentaryService implements Service<Commentary> {
#Autowired
CommentaryDao commentaryDao;
#Transactional
public void persist(Commentary entity) {
commentaryDao.persist(entity);
}
#Transactional
public void update(Commentary entity) {
commentaryDao.update(entity);
}
#Transactional
public void delete(int id) {
commentaryDao.delete(commentaryDao.findById(id));
}
#Transactional
public Commentary findById(int id) {
return (Commentary) commentaryDao.findById(id);
}
#Transactional
public List<Commentary> findAll() {
return commentaryDao.findAll();
}
}
I'm trying to add with this:
Commentary commentary = new Commentary(simpleUserService.findById(idAuthor),
comment,
eventService.findById(idEvent),
rate);
commentaryService.persist(commentary);
Id generate by class ID:
package org.jazzteam.domain.id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.MappedSuperclass;
/**
* #author Yura
* #version 1.0
*/
#MappedSuperclass
public abstract class Id {
#javax.persistence.Id
#GeneratedValue(strategy = GenerationType.AUTO)
protected int id;
public Id() {
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
}
What could be my mistake?
looks like you're trying to reinvent the wheel.
We might focus closely on your code, but I have a more general suggestion.
You already use Spring and Hibernate. Why not just use it as most people use it in 2017 - with Spring Data JPA.
You can google that and find lots of great tutorials about that topic.
Here is an official Spring introduction: https://spring.io/guides/gs/accessing-data-jpa/
a GitHub project with some examples: https://github.com/spring-projects/spring-data-examples
and a reference: https://docs.spring.io/spring-data/jpa/docs/current/reference/html/
hope that helps :)
cheers
Solved this problem by changing:
#Override
public void persist(Commentary entity) {
sessionFactory.getCurrentSession().persist(entity);
}
to
#Override
public void persist(Commentary entity) {
sessionFactory.getCurrentSession().save(entity);
}
Perhaps it will be useful to someone :)
Related
My controller class is -
package com.javatechie.crud.example.controller;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import com.javatechie.crud.example.entity.Product;
import com.javatechie.crud.example.service.ProductService;
public class ProductListController {
#Autowired
private ProductService service;
#GetMapping("/GetProduct")
public List<Product> addProducts(#RequestBody Product products) throws IOException, ClassNotFoundException, SQLException {
System.out.println("Inside addProducts controller method");
return service.saveProducts(1);
}
}
My entity class is -
package com.javatechie.crud.example.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="PRODUCT_TBL")
public class Product {
#Id
#GeneratedValue
private int id;
private String name;
private String quantity;
private double price;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
JpaRepository implementation is -
package com.javatechie.crud.example.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="PRODUCT_TBL")
public class Product {
#Id
#GeneratedValue
private int id;
private String name;
private String quantity;
private double price;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
And the service class is -
package com.javatechie.crud.example.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.javatechie.crud.example.entity.Product;
import com.javatechie.crud.example.repository.ProductRepository;
#Service
public class ProductService {
#Autowired
private ProductRepository repository;
public List<Product> saveProducts(int id) {
return repository.GetRepo(id);
}
}
And , the unexpected output which it is giving is -
Database table is as follows -
The output which I was expecting is the json body with sql record having id , name ,price,quantity . How can I achieve this output with native query only ? Please help.
You should add #RestController and #RequestMapping annotations for processing incoming REST requests.
#RestController
#RequestMapping("/api")
public class ProductListController {
#Autowired
private ProductService service;
#GetMapping("/GetProduct")
public List<Product> addProducts(#RequestBody Product products) throws IOException, ClassNotFoundException, SQLException {
System.out.println("Inside addProducts controller method");
return service.saveProducts(1);
}
}
My main class is :
package com.ashwin.jpafirst;
import com.ashwin.jpafirst.model.Person;
import com.ashwin.jpafirst.reposit.PersonJpaRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class JpafirstApplication implements CommandLineRunner {
private Logger logger= LoggerFactory.getLogger(this.getClass());
#Autowired
PersonJpaRepository personJpaRepository;
public static void main(String[] args)
{
SpringApplication.run(JpafirstApplication.class, args);
}
#Override
public void run(String... args) throws Exception {
// TODO Auto-generated method stub
logger.info("User id is ",personJpaRepository.findById(2));
}
}
Person.java
package com.ashwin.jpafirst.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
#Entity
#Table(name="person")
public class Person {
#Id
#GeneratedValue
private int id;
#Column(name="name")
private String name;
private String location;
private Date dateOfBirth;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public Person(int id, String name, String location, Date dateOfBirth) {
this.id = id;
this.name = name;
this.location = location;
this.dateOfBirth = dateOfBirth;
}
public Person() {
}
}
my application properties is:
## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
spring.datasource.url = jdbc:mysql://localhost:3306/jpaintro
spring.datasource.username = root
spring.datasource.password =
## Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update
PersonJpaRepository.java
package com.ashwin.jpafirst.reposit;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.ashwin.jpafirst.model.Person;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
#Repository
#Transactional
public class PersonJpaRepository {
//connects to Databse
#PersistenceContext
EntityManager entityManager;
public Person findById(int id) {
return entityManager.find(Person.class, id);
}
}
I have also data saved in database as:
But when I try to receive the Person object by Id using
logger.info("User id is ",personJpaRepository.findById(2));
I am just getting as :
As Person object needs to print there,but the code is successfully compiling but I am not getting the information regarding the person.My code has no error but it is not retrieving the data.Why is the Person object not printing in the console?
This question already has answers here:
Spring Boot Hibernate 5 Ignoring #Table and #Column
(2 answers)
Closed 5 years ago.
I try to use CrudRepository on my work. And When the sql request appear on my log, It's just abnormal.
The real table is 'AllDatabase.AllUserInfo' but the generated sql request look like 'all_user_info alluresinf0_', which is unusable.
I have been all over the internet and nobody seems to face my problem (as far as I know). So please somebody tell me if I'm missing some configuration in my project.
I work on Intellij Idea with 'Spring Initializer' with 'Web' , 'JPA' , 'MySQL' selected. These are my code.
here is my Repository
package com.chuchurest.proj.Repository;
import com.chuchurest.proj.Entity.AllUserInfo;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Created by slimshady23 on 6/25/2017 AD.
*/
#Transactional
#Repository
public interface UserRepository extends CrudRepository<AllUserInfo,String> {
}
here is The 'AllUserInfo' Entity
package com.chuchurest.proj.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import java.io.Serializable;
/**
* Created by slimshady23 on 6/23/2017 AD.
*/
#Entity
#Table(name = "AllUserInfo")
public class AllUserInfo {
#Id
#GeneratedValue(strategy=GenerationType.AUTO)
private String Id;
#Column(name="username")
private String Username;
#Column(name="password")
private String Password;
#Column(name="email")
private String Email;
#Column(name="phone")
private String Phone;
#Column(name="rating")
private Integer Rating;
#Column(name="skill")
private Integer Skill;
#Column(name="description")
private String Description;
public String getId() {
return Id;
}
public void setId(String id) {
Id = id;
}
public String getUsername() {
return Username;
}
public void setUsername(String username) {
Username = username;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public String getEmail() {
return Email;
}
public void setEmail(String email) {
Email = email;
}
public String getPhone() {
return Phone;
}
public void setPhone(String phone) {
Phone = phone;
}
public Integer getRating() {
return Rating;
}
public void setRating(Integer rating) {
Rating = rating;
}
public Integer getSkill() {
return Skill;
}
public void setSkill(Integer skill) {
Skill = skill;
}
public String getDescription() {
return Description;
}
public void setDescription(String description) {
Description = description;
}
}
And this is how I invoke the save() method
package com.chuchurest.proj.Service;
import com.chuchurest.proj.DAO.UserInfoDAO;
import com.chuchurest.proj.Entity.AllUserInfo;
import com.chuchurest.proj.Repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by slimshady23 on 6/24/2017 AD.
*/
#Service
public class AppService {
#Autowired
private UserRepository userRepository;
public void PerformRegister(AllUserInfo userinfo)
{
userRepository.save(userinfo);
}
}
And here is the Application.properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/AllDatabase
spring.datasource.username=root
spring.datasource.password= ******
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQLDialect
spring.jpa.properties.hibernate.id.new_generator_mappings = false
spring.jpa.properties.hibernate.format_sql = true
spring.jpa.show-sql= true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
Note the dot, the difference between schema.tablename and tablename alias
The AllUserInfo_f0 is an alias for AllUserInfo. It's used in Hibernate by default for supporting query relations on the same table multiple times. It doesn't break your sql.
Hibernate is not generating any tables when certain tables are added to hibernate.cfg.xml:
If I add:
<mapping class="org.hibernate.tutorial.annotations.Movie"/>
<mapping class="org.hibernate.tutorial.annotations.Actor"/>
No tables are generated at all, I already have:
<property name="hibernate.hbm2ddl.auto">update</property>
In hibernate.cfg.xml, and I have already tried variations of this, I know that the issue is with these classes as other classes work fine and are auto-generated when these are not added.
Actor
package org.hibernate.tutorial.annotations;
import java.util.Set;
import javax.persistence.*;
#Entity
#Table(name="ACTOR")
public class Actor {
#Id #Column(name="ACTOR_ID")
private int id;
#Column(nullable=false, unique=true)
private String name;
#ManyToMany(
targetEntity=Movie.class,
cascade={CascadeType.PERSIST, CascadeType.MERGE}
)
#JoinTable(
name="Actor_Movie",
joinColumns=#JoinColumn(name="ACTOR_ID"),
inverseJoinColumns=#JoinColumn(name="MOVIE_ID")
)
private Set<Movie> films;
public Actor(){
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Set<Movie> getFilms() {
return films;
}
public void setFilms(Set<Movie> films) {
this.films = films;
}
}
Movie
import java.sql.Time;
import java.util.Set;
import javax.persistence.*;
#Entity
#Table(name="MOVIE")
public class Movie {
#Id #Column(name="MOVIE_ID")
private int id;
#Column(nullable=false,unique=true)
private String title;
#ManyToMany(
targetEntity=Track.class,
cascade={CascadeType.PERSIST, CascadeType.MERGE},
mappedBy = "movies"
)
private Set<Actor> actors;
private Time playTime;
public Movie(){
}
public int getId(){
return id;
}
public String getTitle(){
return title;
}
public Set<Actor> getActors(){
return actors;
}
public Time getTime(){
return playTime;
}
public void setTime(Time playTime){
this.playTime = playTime;
}
public void setId(int id){
this.id = id;
}
public void setTitle(String name){
this.title = name;
}
public void setActors(Set<Actor> actors){
this.actors = actors;
}
}
ResetDB
import java.util.HashSet;
import java.util.Set;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
import junit.framework.TestCase;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class ResetDB extends TestCase{
private SessionFactory sessionFactory;
#Override
protected void setUp() throws Exception {
// A SessionFactory is set up once for an application
sessionFactory = new Configuration()
.configure() // configures settings from hibernate.cfg.xml
.buildSessionFactory();
}
#Override
protected void tearDown() throws Exception {
if ( sessionFactory != null ) {
sessionFactory.close();
}
}
public void testResetDB() {
Session session = sessionFactory.openSession();
session.beginTransaction();
try {
Query q = session.createSQLQuery("delete from ACTOR");
q.executeUpdate();
q = session.createSQLQuery("delete from MOVIE");
q.executeUpdate();
session.getTransaction().commit();
} catch (Exception e) {
System.out.println("Exception: "+e.getLocalizedMessage());
System.out.println("Transaction rolled back");
session.getTransaction().rollback();
}
session.close();
}
}
using hibernate-core-4.1.6
I am trying to populate some entity objects in a very simple Hibernate example. My database consists of two tables, "Departments" (Id, Name) and "Employees" (Id, DepartmentsId, FirstName, LastName). My SQL query is simply a left join of Employees to Departments.
I have set up the annotations as specified in the Hibernate documentation, but whenever I try to serialize the entities Hibernate goes into an endless loop and eventually throws a StackOverFlowError exception. Someone answering another question of mine was able to determine that the stack overflow is happening because the "Department" object contains a set of "Employee" objects, which each contain a "Department" object, which contains a set of Employee objects, etc. etc.
This type of bidirectional relationship is supposed to be legal as per the documentation linked above (the "mappedBy" parameter in Department is supposed to clue Hibernate in; I have also tried using the "joinColumn" annotation that is commented out in the code below), and other things I have read indicate the Hibernate is supposed to be smart enough not to go into an endless loop in this situation, but it is not working for my example. Everything works fine if I change the bidirectional relationship to a unidirectional relationship by removing the Department object from the Employee class, but obviously this causes the loss of a lot of functionality.
I have also tried foregoing the annotations for the older xml mapping files and setting the "inverse" parameter for the child table, but it still produces the same problem. How can I get this bidirectional relationship working the way it is supposed to work?
Department:
package com.test.model;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinTable;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.JoinColumn;
import org.hibernate.Hibernate;
import org.hibernate.proxy.HibernateProxy;
#Entity
#Table(name="Departments"
,catalog="test"
)
public class Department implements java.io.Serializable {
private Integer id;
private String name;
public Set<Employee> employees = new HashSet<Employee>(0);
public Department() {
}
public Department(String name) {
this.name = name;
}
public Department(String name, Set employees) {
this.name = name;
this.employees = employees;
}
#Id #GeneratedValue(strategy=IDENTITY)
#Column(name="Id", unique=true, nullable=false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
#Column(name="Name", nullable=false)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
#OneToMany(fetch=FetchType.LAZY, mappedBy="department")
/*#OneToMany
#JoinColumn(name="DepartmentsId")*/
public Set<Employee> getEmployees() {
return this.employees;
}
public void setEmployees(Set employees) {
this.employees = employees;
}
}
Employee:
package com.test.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinTable;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
#Entity
#Table(name="Employees"
,catalog="test"
)
public class Employee implements java.io.Serializable {
private Integer id;
private Department department;
private String firstName;
private String lastName;
public Employee() {
}
public Employee(Department department, String firstName, String lastName) {
this.department = department;
this.firstName = firstName;
this.lastName = lastName;
}
#Id #GeneratedValue(strategy=IDENTITY)
#Column(name="Id", unique=true, nullable=false)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
#ManyToOne
#JoinColumn(name="DepartmentsId", nullable=false, insertable=false, updatable=false)
public Department getDepartment() {
return this.department;
}
public void setDepartment(Department department) {
this.department = department;
}
#Column(name="FirstName", nullable=false)
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
#Column(name="LastName", nullable=false)
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
Department Manager (Contains the HQL query):
package com.test.controller;
import java.util.Collections;
import java.util.List;
import java.util.Iterator;
import org.hibernate.Criteria;
import org.hibernate.Hibernate;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import com.test.model.Department;
import com.test.util.HibernateUtil;
public class DepartmentManager extends HibernateUtil {
public List<Department> list() {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
List<Department> set = null;
try {
Query q = session.createQuery("FROM Department d JOIN FETCH d.employees e");
q.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
set = (List<Department>) q.list();
} catch (HibernateException e) {
e.printStackTrace();
session.getTransaction().rollback();
}
session.getTransaction().commit();
return set;
}
}
In general, you should not serialize your entities. Circular dependencies and proxies make that hard. Instead, you should manually transfer the data you need to send to a DTO (a new data-only class), and serialize it instead. It won't have the lazy collections, proxies, and whatnot.
For complement the top response i did a generic convert who do the job for me, transfering the entity values to DTO object, you just have to make your dto fields with the same name from the mapped entity.
Here is the source code.
/**
* Atribui os valores de campos correspondentes de um objeto para um outro objeto de destino. Os
* campos do objeto de destino que ja estiverem preenchidos nao serao substituidos
*
* #param objetoOrigem
* #param objetoDestino
* #return
* #throws NegocioException
*/
public static <T1, T2> T2 convertEntity(T1 objetoOrigem, T2 objetoDestino) throws NegocioException {
if (objetoOrigem != null && objetoDestino != null) {
Class<? extends Object> classe = objetoOrigem.getClass();
Class<? extends Object> classeDestino = objetoDestino.getClass();
Field[] listaCampos = classe.getDeclaredFields();
for (int i = 0; i < listaCampos.length; i++) {
Field campo = listaCampos[i];
try {
Field campoDestino = classeDestino.getDeclaredField(campo.getName());
campo.setAccessible(true);
campoDestino.setAccessible(true);
atribuiValorAoDestino(objetoOrigem, objetoDestino, campo, campoDestino);
} catch (NoSuchFieldException e) {
LOGGER.log(Logger.Level.TRACE, (Object) e);
continue;
} catch (IllegalArgumentException | IllegalAccessException e) {
LOGGER.error(e.getMessage(), e);
throw new NegocioException(e.getMessage(), EnumTypeException.ERROR);
}
}
}
return objetoDestino;
}