Re-enabled additional tests

This commit is contained in:
Andrea Boriero 2021-10-12 18:44:49 +02:00 committed by Andrea Boriero
parent 92e1f593dc
commit cc31223b78
7 changed files with 281 additions and 5 deletions

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.test.bytecode.enhancement.lazy.group;
package org.hibernate.orm.test.bytecode.enhancement.lazy.group;
import org.hibernate.annotations.LazyGroup;
import org.hibernate.bytecode.enhance.spi.UnloadedClass;

View File

@ -0,0 +1,75 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import org.hibernate.annotations.LazyGroup;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
/**
* @author Steve Ebersole
*/
@Entity(name = "Activity")
@Table(name = "activity")
@SuppressWarnings("WeakerAccess")
public class Activity extends BaseEntity {
private String description;
private Instruction instruction;
protected WebApplication webApplication = null;
/**
* Used by Hibernate
*/
@SuppressWarnings("unused")
public Activity() {
super();
}
public Activity(Integer id, String description, Instruction instruction) {
super( id );
this.description = description;
this.instruction = instruction;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
@LazyGroup("Instruction")
@JoinColumn(name = "Instruction_Id")
public Instruction getInstruction() {
return instruction;
}
@SuppressWarnings("unused")
public void setInstruction(Instruction instruction) {
this.instruction = instruction;
}
@SuppressWarnings("unused")
@ManyToOne(fetch=FetchType.LAZY)
@LazyGroup("webApplication")
@JoinColumn(name="web_app_oid")
public WebApplication getWebApplication() {
return webApplication;
}
public void setWebApplication(WebApplication webApplication) {
this.webApplication = webApplication;
}
}

View File

@ -0,0 +1,49 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* @author Steve Ebersole
*/
@Entity(name = "Address")
@Table(name = "address")
public class Address {
private Integer id;
private String text;
public Address() {
}
public Address(Integer id, String text) {
this.id = id;
this.text = text;
}
@Id
@Column(name = "oid")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

View File

@ -0,0 +1,45 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import jakarta.persistence.Column;
import jakarta.persistence.Id;
import jakarta.persistence.MappedSuperclass;
/**
* @author Steve Ebersole
*/
@MappedSuperclass
public class BaseEntity {
protected Integer id;
protected String nbr;
public BaseEntity() {
}
public BaseEntity(Integer id) {
this.id = id;
}
@Id
@Column( name = "oid" )
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNbr() {
return nbr;
}
public void setNbr(String nbr) {
this.nbr = nbr;
}
}

View File

@ -0,0 +1,41 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
/**
* @author Steve Ebersole
*/
@Entity(name = "Instruction")
@Table(name = "instruction")
public class Instruction extends BaseEntity {
private String summary;
/**
* Used by Hibernate
*/
@SuppressWarnings("unused")
public Instruction() {
super();
}
@SuppressWarnings("WeakerAccess")
public Instruction(Integer id, String summary) {
super( id );
this.summary = summary;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
}

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.test.bytecode.enhancement.lazy.proxy;
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import org.hibernate.Hibernate;
import org.hibernate.boot.MetadataSources;
@ -20,9 +20,6 @@ import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.EnhancementOptions;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.test.bytecode.enhancement.lazy.proxy.Activity;
import org.hibernate.test.bytecode.enhancement.lazy.proxy.Instruction;
import org.hibernate.test.bytecode.enhancement.lazy.proxy.WebApplication;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

View File

@ -0,0 +1,69 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.orm.test.bytecode.enhancement.lazy.proxy;
import java.util.HashSet;
import java.util.Set;
import org.hibernate.annotations.LazyGroup;
import org.hibernate.annotations.NaturalId;
import jakarta.persistence.Basic;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
/**
* @author Steve Ebersole
*/
@Entity
@Table( name="web_app" )
public class WebApplication extends BaseEntity {
private String name;
private String siteUrl;
private Set<Activity> activities = new HashSet<>();
@SuppressWarnings("unused")
public WebApplication() {
}
public WebApplication(Integer id, String siteUrl) {
super( id );
this.siteUrl = siteUrl;
}
@NaturalId
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Basic( fetch = FetchType.LAZY )
public String getSiteUrl() {
return siteUrl;
}
public void setSiteUrl(String siteUrl) {
this.siteUrl = siteUrl;
}
@OneToMany(mappedBy="webApplication", fetch= FetchType.LAZY)
@LazyGroup("app_activity_group")
// @CollectionType(type="baseutil.technology.hibernate.IskvLinkedSetCollectionType")
public Set<Activity> getActivities() {
return activities;
}
public void setActivities(Set<Activity> activities) {
this.activities = activities;
}
}