copy some test entities from core tests to modelgen tests
This commit is contained in:
parent
294ec27885
commit
0c4439b731
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "ADDRESS")
|
||||
public class Address implements java.io.Serializable {
|
||||
private String id;
|
||||
private String street;
|
||||
private String city;
|
||||
private String state;
|
||||
private String zip;
|
||||
private List<Phone> phones = new java.util.ArrayList<Phone>();
|
||||
|
||||
public Address() {
|
||||
}
|
||||
|
||||
public Address(String id, String street, String city, String state, String zip) {
|
||||
this.id = id;
|
||||
this.street = street;
|
||||
this.city = city;
|
||||
this.state = state;
|
||||
this.zip = zip;
|
||||
}
|
||||
|
||||
public Address(String id, String street, String city, String state, String zip,
|
||||
List<Phone> phones) {
|
||||
this.id = id;
|
||||
this.street = street;
|
||||
this.city = city;
|
||||
this.state = state;
|
||||
this.zip = zip;
|
||||
this.phones = phones;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "STREET")
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String street) {
|
||||
this.street = street;
|
||||
}
|
||||
|
||||
@Column(name = "CITY")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "STATE")
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Column(name = "ZIP")
|
||||
public String getZip() {
|
||||
return zip;
|
||||
}
|
||||
|
||||
public void setZip(String zip) {
|
||||
this.zip = zip;
|
||||
}
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "address")
|
||||
@OrderColumn
|
||||
public List<Phone> getPhones() {
|
||||
return phones;
|
||||
}
|
||||
|
||||
public void setPhones(List<Phone> phones) {
|
||||
this.phones = phones;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "ALIAS_TABLE")
|
||||
public class Alias implements java.io.Serializable {
|
||||
private String id;
|
||||
private String alias;
|
||||
private Customer customerNoop;
|
||||
private Collection<Customer> customersNoop = new java.util.ArrayList<Customer>();
|
||||
private Collection<Customer> customers = new java.util.ArrayList<Customer>();
|
||||
|
||||
public Alias() {
|
||||
}
|
||||
|
||||
public Alias(String id, String alias) {
|
||||
this.id = id;
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "ALIAS")
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "FK1_FOR_CUSTOMER_TABLE", insertable = false, updatable = false)
|
||||
public Customer getCustomerNoop() {
|
||||
return customerNoop;
|
||||
}
|
||||
|
||||
public void setCustomerNoop(Customer customerNoop) {
|
||||
this.customerNoop = customerNoop;
|
||||
}
|
||||
|
||||
@ManyToMany(cascade = CascadeType.ALL)
|
||||
@JoinTable(name = "FKS_ANOOP_CNOOP",
|
||||
joinColumns =
|
||||
@JoinColumn(
|
||||
name = "FK2_FOR_ALIAS_TABLE", referencedColumnName = "ID"),
|
||||
inverseJoinColumns =
|
||||
@JoinColumn(
|
||||
name = "FK8_FOR_CUSTOMER_TABLE", referencedColumnName = "ID")
|
||||
)
|
||||
public Collection<Customer> getCustomersNoop() {
|
||||
return customersNoop;
|
||||
}
|
||||
|
||||
public void setCustomersNoop(Collection<Customer> customersNoop) {
|
||||
this.customersNoop = customersNoop;
|
||||
|
||||
}
|
||||
|
||||
@ManyToMany(cascade = CascadeType.ALL)
|
||||
@JoinTable(name = "FKS_ALIAS_CUSTOMER",
|
||||
joinColumns =
|
||||
@JoinColumn(
|
||||
name = "FK_FOR_ALIAS_TABLE", referencedColumnName = "ID"),
|
||||
inverseJoinColumns =
|
||||
@JoinColumn(
|
||||
name = "FK_FOR_CUSTOMER_TABLE", referencedColumnName = "ID")
|
||||
)
|
||||
public Collection<Customer> getCustomers() {
|
||||
return customers;
|
||||
}
|
||||
|
||||
public void setCustomers(Collection<Customer> customers) {
|
||||
this.customers = customers;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.OneToMany;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity(name = "Article")
|
||||
public class Article {
|
||||
@Id
|
||||
Integer id;
|
||||
@OneToMany
|
||||
Map<Locale, Translation> translations;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
|
||||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.EmbeddedId;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Christian Beikov
|
||||
*/
|
||||
@MappedSuperclass
|
||||
public abstract class BaseEmbeddedEntity<I extends Serializable> implements Serializable {
|
||||
|
||||
private I id;
|
||||
|
||||
public BaseEmbeddedEntity() {
|
||||
}
|
||||
|
||||
public BaseEmbeddedEntity(I id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@EmbeddedId
|
||||
public I getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(I id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash = 47 * hash + (this.id != null ? this.id.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final BaseEmbeddedEntity<?> other = (BaseEmbeddedEntity<?>) obj;
|
||||
if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import org.hibernate.jpamodelgen.test.util.CompilationTest;
|
||||
import org.hibernate.jpamodelgen.test.util.WithClasses;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hibernate.jpamodelgen.test.util.TestUtil.assertMetamodelClassGeneratedFor;
|
||||
|
||||
/**
|
||||
* @author Hardy Ferentschik
|
||||
*/
|
||||
public class CoreTest extends CompilationTest {
|
||||
@Test
|
||||
@WithClasses({MapEntity.class, MapEntityLocal.class, Order.class, LineItem.class, CreditCard.class, Customer.class,
|
||||
PersonId.class, Phone.class, Person.class, Product.class, BaseEmbeddedEntity.class, VersionedEntity.class, ShelfLife.class,
|
||||
SomeMappedSuperclass.class, SomeMappedSuperclassSubclass.class, Article.class, Alias.class, Address.class, Info.class,
|
||||
Country.class, Thing.class, ThingWithQuantity.class, Translation.class, Entity1.class, Entity2.class, Entity3.class})
|
||||
public void testGeneratedAnnotationNotGenerated() throws Exception {
|
||||
for (Class<?> c : getClass().getMethod("testGeneratedAnnotationNotGenerated").getAnnotation(WithClasses.class).value()) {
|
||||
assertMetamodelClassGeneratedFor(c);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Embeddable
|
||||
public class Country implements java.io.Serializable {
|
||||
private String country;
|
||||
private String code;
|
||||
|
||||
public Country() {
|
||||
}
|
||||
|
||||
public Country(String v1, String v2) {
|
||||
country = v1;
|
||||
code = v2;
|
||||
}
|
||||
|
||||
@Basic
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String v) {
|
||||
country = v;
|
||||
}
|
||||
|
||||
@Basic
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String v) {
|
||||
code = v;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "CREDITCARD_TABLE")
|
||||
public class CreditCard implements java.io.Serializable {
|
||||
private String id;
|
||||
private String number;
|
||||
private String type;
|
||||
private String expires;
|
||||
private boolean approved;
|
||||
private double balance;
|
||||
private Order order;
|
||||
private Customer customer;
|
||||
|
||||
public CreditCard() {
|
||||
}
|
||||
|
||||
public CreditCard(
|
||||
String v1, String v2, String v3, String v4,
|
||||
boolean v5, double v6, Order v7, Customer v8) {
|
||||
id = v1;
|
||||
number = v2;
|
||||
type = v3;
|
||||
expires = v4;
|
||||
approved = v5;
|
||||
balance = v6;
|
||||
order = v7;
|
||||
customer = v8;
|
||||
}
|
||||
|
||||
public CreditCard(
|
||||
String v1, String v2, String v3, String v4,
|
||||
boolean v5, double v6) {
|
||||
id = v1;
|
||||
number = v2;
|
||||
type = v3;
|
||||
expires = v4;
|
||||
approved = v5;
|
||||
balance = v6;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String v) {
|
||||
id = v;
|
||||
}
|
||||
|
||||
@Column(name = "CREDITCARD_NUMBER")
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String v) {
|
||||
number = v;
|
||||
}
|
||||
|
||||
@Column(name = "`TYPE`")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String v) {
|
||||
type = v;
|
||||
}
|
||||
|
||||
@Column(name = "EXPIRES")
|
||||
public String getExpires() {
|
||||
return expires;
|
||||
}
|
||||
|
||||
public void setExpires(String v) {
|
||||
expires = v;
|
||||
}
|
||||
|
||||
@Column(name = "APPROVED")
|
||||
public boolean getApproved() {
|
||||
return approved;
|
||||
}
|
||||
|
||||
public void setApproved(boolean v) {
|
||||
approved = v;
|
||||
}
|
||||
|
||||
@Column(name = "BALANCE")
|
||||
public double getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(double v) {
|
||||
balance = v;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "FK_FOR_ORDER_TABLE")
|
||||
public Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Order v) {
|
||||
order = v;
|
||||
}
|
||||
|
||||
@ManyToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "FK3_FOR_CUSTOMER_TABLE")
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer v) {
|
||||
customer = v;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "CUSTOMER_TABLE")
|
||||
public class Customer implements java.io.Serializable {
|
||||
private String id;
|
||||
private String name;
|
||||
private Integer age;
|
||||
private Address home;
|
||||
private Address work;
|
||||
private Country country;
|
||||
private Spouse spouse;
|
||||
private Collection<CreditCard> creditCards = new java.util.ArrayList<CreditCard>();
|
||||
private Collection<Order> orders = new java.util.ArrayList<Order>();
|
||||
private Collection<Alias> aliases = new java.util.ArrayList<Alias>();
|
||||
private Collection<Alias> aliasesNoop = new java.util.ArrayList<Alias>();
|
||||
|
||||
public Customer() {
|
||||
}
|
||||
|
||||
public Customer(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// Used by test case for HHH-8699.
|
||||
public Customer(String id, String name, String greeting, Boolean something) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Customer(String id, String name, Country country) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public Customer(String id, String name, Address home,
|
||||
Address work, Country country) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.home = home;
|
||||
this.work = work;
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String v) {
|
||||
this.id = v;
|
||||
}
|
||||
|
||||
@Column(name = "NAME")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String v) {
|
||||
this.name = v;
|
||||
}
|
||||
|
||||
@Column(name = "AGE")
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
@Embedded
|
||||
public Country getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(Country v) {
|
||||
this.country = v;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "FK6_FOR_CUSTOMER_TABLE")
|
||||
public Address getHome() {
|
||||
return home;
|
||||
}
|
||||
|
||||
public void setHome(Address v) {
|
||||
this.home = v;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "FK5_FOR_CUSTOMER_TABLE")
|
||||
public Address getWork() {
|
||||
return work;
|
||||
}
|
||||
|
||||
public void setWork(Address v) {
|
||||
this.work = v;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, mappedBy = "customer")
|
||||
public Spouse getSpouse() {
|
||||
return spouse;
|
||||
}
|
||||
|
||||
public void setSpouse(Spouse v) {
|
||||
this.spouse = v;
|
||||
}
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
|
||||
public Collection<CreditCard> getCreditCards() {
|
||||
return creditCards;
|
||||
}
|
||||
|
||||
public void setCreditCards(Collection<CreditCard> v) {
|
||||
this.creditCards = v;
|
||||
}
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
|
||||
public Collection<Order> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public void setOrders(Collection<Order> v) {
|
||||
this.orders = v;
|
||||
}
|
||||
|
||||
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "customers")
|
||||
public Collection<Alias> getAliases() {
|
||||
return aliases;
|
||||
}
|
||||
|
||||
public void setAliases(Collection<Alias> v) {
|
||||
this.aliases = v;
|
||||
}
|
||||
|
||||
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "customersNoop")
|
||||
public Collection<Alias> getAliasesNoop() {
|
||||
return aliasesNoop;
|
||||
}
|
||||
|
||||
public void setAliasesNoop(Collection<Alias> v) {
|
||||
this.aliasesNoop = v;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2015, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "entity1")
|
||||
public class Entity1 {
|
||||
@Id
|
||||
private long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name="entity2_id", nullable = false)
|
||||
private Entity2 entity2;
|
||||
|
||||
@Column(name = "val")
|
||||
private String value;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2015, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "entity2")
|
||||
public class Entity2 {
|
||||
@Id
|
||||
private long id;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name="entity3_id")
|
||||
private Entity3 entity3;
|
||||
|
||||
@Column(name = "val")
|
||||
private String value;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2015, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "entity3")
|
||||
public class Entity3 {
|
||||
@Id
|
||||
private long id;
|
||||
|
||||
@Column(name = "val")
|
||||
private String value;
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "INFO_TABLE")
|
||||
public class Info implements java.io.Serializable {
|
||||
private String id;
|
||||
private String street;
|
||||
private String city;
|
||||
private String state;
|
||||
private String zip;
|
||||
private Spouse spouse;
|
||||
|
||||
public Info() {
|
||||
}
|
||||
|
||||
public Info(String v1, String v2, String v3, String v4, String v5) {
|
||||
id = v1;
|
||||
street = v2;
|
||||
city = v3;
|
||||
state = v4;
|
||||
zip = v5;
|
||||
}
|
||||
|
||||
public Info(
|
||||
String v1, String v2, String v3, String v4,
|
||||
String v5, Spouse v6) {
|
||||
id = v1;
|
||||
street = v2;
|
||||
city = v3;
|
||||
state = v4;
|
||||
zip = v5;
|
||||
spouse = v6;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String v) {
|
||||
id = v;
|
||||
}
|
||||
|
||||
@Column(name = "INFOSTREET")
|
||||
public String getStreet() {
|
||||
return street;
|
||||
}
|
||||
|
||||
public void setStreet(String v) {
|
||||
street = v;
|
||||
}
|
||||
|
||||
@Column(name = "INFOSTATE")
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String v) {
|
||||
state = v;
|
||||
}
|
||||
|
||||
@Column(name = "INFOCITY")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String v) {
|
||||
city = v;
|
||||
}
|
||||
|
||||
@Column(name = "INFOZIP")
|
||||
public String getZip() {
|
||||
return zip;
|
||||
}
|
||||
|
||||
public void setZip(String v) {
|
||||
zip = v;
|
||||
}
|
||||
|
||||
@OneToOne(mappedBy = "info") @JoinTable( name = "INFO_SPOUSE_TABLE" )
|
||||
public Spouse getSpouse() {
|
||||
return spouse;
|
||||
}
|
||||
|
||||
public void setSpouse(Spouse v) {
|
||||
this.spouse = v;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "LINEITEM_TABLE")
|
||||
public class LineItem implements java.io.Serializable {
|
||||
private String id;
|
||||
private int quantity;
|
||||
private Order order;
|
||||
private Product product;
|
||||
|
||||
public LineItem() {
|
||||
}
|
||||
|
||||
public LineItem(String v1, int v2, Order v3, Product v4) {
|
||||
id = v1;
|
||||
quantity = v2;
|
||||
order = v3;
|
||||
product = v4;
|
||||
}
|
||||
|
||||
public LineItem(String v1, int v2) {
|
||||
id = v1;
|
||||
quantity = v2;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String v) {
|
||||
id = v;
|
||||
}
|
||||
|
||||
@Column(name = "QUANTITY")
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int v) {
|
||||
quantity = v;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "FK1_FOR_ORDER_TABLE")
|
||||
public Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Order v) {
|
||||
order = v;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "FK_FOR_PRODUCT_TABLE")
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(Product v) {
|
||||
product = v;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Entity
|
||||
@Table( name = "MAP_ENTITY" )
|
||||
public class MapEntity {
|
||||
|
||||
@Id
|
||||
@Column(name="key_")
|
||||
private String key;
|
||||
|
||||
@ElementCollection(fetch=FetchType.LAZY)
|
||||
@CollectionTable(name="MAP_ENTITY_NAME", joinColumns=@JoinColumn(name="key_"))
|
||||
@MapKeyColumn(name="lang_")
|
||||
private Map<String, MapEntityLocal> localized;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class MapEntityLocal {
|
||||
|
||||
@Column(name="short_name")
|
||||
private String shortName;
|
||||
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
public void setShortName(String shortName) {
|
||||
this.shortName = shortName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "ORDER_TABLE")
|
||||
public class Order implements java.io.Serializable {
|
||||
private String id;
|
||||
private double totalPrice;
|
||||
private Customer customer;
|
||||
private CreditCard creditCard;
|
||||
private LineItem sampleLineItem;
|
||||
private Collection<LineItem> lineItems = new java.util.ArrayList<LineItem>();
|
||||
|
||||
private char[] domen;
|
||||
private byte[] number;
|
||||
|
||||
public Order() {
|
||||
}
|
||||
|
||||
public Order(String id, double totalPrice) {
|
||||
this.id = id;
|
||||
this.totalPrice = totalPrice;
|
||||
}
|
||||
|
||||
public Order(String id, Customer customer) {
|
||||
this.id = id;
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
public Order(String id, char[] domen) {
|
||||
this.id = id;
|
||||
this.domen = domen;
|
||||
}
|
||||
|
||||
|
||||
public Order(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
// getters and setters for State fields
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "TOTALPRICE")
|
||||
public double getTotalPrice() {
|
||||
return totalPrice;
|
||||
}
|
||||
|
||||
public void setTotalPrice(double price) {
|
||||
this.totalPrice = price;
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
// getters and setters for Association fields
|
||||
|
||||
// MANYx1
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(
|
||||
name = "FK4_FOR_CUSTOMER_TABLE")
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
|
||||
//1x1
|
||||
|
||||
@OneToOne(mappedBy = "order")
|
||||
public CreditCard getCreditCard() {
|
||||
return creditCard;
|
||||
}
|
||||
|
||||
public void setCreditCard(CreditCard cc) {
|
||||
this.creditCard = cc;
|
||||
}
|
||||
|
||||
// 1x1
|
||||
|
||||
@OneToOne(cascade = CascadeType.REMOVE)
|
||||
@JoinColumn(
|
||||
name = "FK0_FOR_LINEITEM_TABLE")
|
||||
public LineItem getSampleLineItem() {
|
||||
return sampleLineItem;
|
||||
}
|
||||
|
||||
public void setSampleLineItem(LineItem l) {
|
||||
this.sampleLineItem = l;
|
||||
}
|
||||
|
||||
//1xMANY
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "order")
|
||||
public Collection<LineItem> getLineItems() {
|
||||
return lineItems;
|
||||
}
|
||||
|
||||
public void setLineItems(Collection<LineItem> c) {
|
||||
this.lineItems = c;
|
||||
}
|
||||
|
||||
public char[] getDomen() {
|
||||
return domen;
|
||||
}
|
||||
|
||||
public void setDomen(char[] d) {
|
||||
domen = d;
|
||||
}
|
||||
|
||||
@Column(name="fld_number")
|
||||
public byte[] getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(byte[] n) {
|
||||
number = n;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
|
||||
/**
|
||||
* @author Christian Beikov
|
||||
*/
|
||||
@Entity
|
||||
public class Person extends BaseEmbeddedEntity<PersonId> {
|
||||
|
||||
private String firstName;
|
||||
private String lastName;
|
||||
|
||||
public Person() {
|
||||
}
|
||||
|
||||
public Person(PersonId id, String firstName, String lastName) {
|
||||
super(id);
|
||||
this.firstName = firstName;
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Christian Beikov
|
||||
*/
|
||||
@Embeddable
|
||||
public class PersonId implements Serializable {
|
||||
|
||||
private String ssn;
|
||||
private String name;
|
||||
|
||||
public PersonId() {
|
||||
}
|
||||
|
||||
public PersonId(String ssn, String name) {
|
||||
this.ssn = ssn;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSsn() {
|
||||
return ssn;
|
||||
}
|
||||
|
||||
public void setSsn(String ssn) {
|
||||
this.ssn = ssn;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 67 * hash + (this.ssn != null ? this.ssn.hashCode() : 0);
|
||||
hash = 67 * hash + (this.name != null ? this.name.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final PersonId other = (PersonId) obj;
|
||||
if ((this.ssn == null) ? (other.ssn != null) : !this.ssn.equals(other.ssn)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "PHONE_TABLE")
|
||||
public class Phone implements java.io.Serializable {
|
||||
public enum Type { LAND_LINE, CELL, FAX, WORK, HOME }
|
||||
|
||||
private String id;
|
||||
private String area;
|
||||
private String number;
|
||||
private Address address;
|
||||
private Set<Type> types;
|
||||
|
||||
public Phone() {
|
||||
}
|
||||
|
||||
public Phone(String v1, String v2, String v3) {
|
||||
id = v1;
|
||||
area = v2;
|
||||
number = v3;
|
||||
}
|
||||
|
||||
public Phone(String v1, String v2, String v3, Address v4) {
|
||||
id = v1;
|
||||
area = v2;
|
||||
number = v3;
|
||||
address = v4;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String v) {
|
||||
id = v;
|
||||
}
|
||||
|
||||
@Column(name = "AREA")
|
||||
public String getArea() {
|
||||
return area;
|
||||
}
|
||||
|
||||
public void setArea(String v) {
|
||||
area = v;
|
||||
}
|
||||
|
||||
@Column(name = "PHONE_NUMBER")
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String v) {
|
||||
number = v;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "FK_FOR_ADDRESS")
|
||||
public Address getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(Address a) {
|
||||
address = a;
|
||||
}
|
||||
|
||||
@ElementCollection
|
||||
public Set<Type> getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public void setTypes(Set<Type> types) {
|
||||
this.types = types;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "PRODUCT_TABLE")
|
||||
@SecondaryTable(name = "PRODUCT_DETAILS", pkJoinColumns = @PrimaryKeyJoinColumn(name = "ID"))
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(name = "PRODUCT_TYPE", discriminatorType = DiscriminatorType.STRING)
|
||||
@DiscriminatorValue("Product")
|
||||
public class Product implements java.io.Serializable {
|
||||
private String id;
|
||||
private String name;
|
||||
private double price;
|
||||
private float rating;
|
||||
private int quantity;
|
||||
private long partNumber;
|
||||
private BigInteger someBigInteger;
|
||||
private BigDecimal someBigDecimal;
|
||||
private String wareHouse;
|
||||
private ShelfLife shelfLife;
|
||||
|
||||
public Product() {
|
||||
}
|
||||
|
||||
public Product(String id, String name, double price, int quantity, long partNumber) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.price = price;
|
||||
this.quantity = quantity;
|
||||
this.partNumber = partNumber;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "NAME")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "PRICE")
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(double price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
@Column(name = "QUANTITY")
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int v) {
|
||||
this.quantity = v;
|
||||
}
|
||||
|
||||
@Column(name = "PNUM")
|
||||
public long getPartNumber() {
|
||||
return partNumber;
|
||||
}
|
||||
|
||||
public void setPartNumber(long v) {
|
||||
this.partNumber = v;
|
||||
}
|
||||
|
||||
public float getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(float rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
public BigInteger getSomeBigInteger() {
|
||||
return someBigInteger;
|
||||
}
|
||||
|
||||
public void setSomeBigInteger(BigInteger someBigInteger) {
|
||||
this.someBigInteger = someBigInteger;
|
||||
}
|
||||
|
||||
@Column( precision = 10, scale = 3)
|
||||
public BigDecimal getSomeBigDecimal() {
|
||||
return someBigDecimal;
|
||||
}
|
||||
|
||||
public void setSomeBigDecimal(BigDecimal someBigDecimal) {
|
||||
this.someBigDecimal = someBigDecimal;
|
||||
}
|
||||
|
||||
@Column(name = "WHOUSE", nullable = true, table = "PRODUCT_DETAILS")
|
||||
public String getWareHouse() {
|
||||
return wareHouse;
|
||||
}
|
||||
|
||||
public void setWareHouse(String v) {
|
||||
this.wareHouse = v;
|
||||
}
|
||||
|
||||
@Embedded
|
||||
@AttributeOverrides({
|
||||
@AttributeOverride(name = "inceptionDate",
|
||||
column = @Column(name = "INCEPTION", nullable = true)),
|
||||
@AttributeOverride(name = "soldDate",
|
||||
column = @Column(name = "SOLD", nullable = true))
|
||||
})
|
||||
public ShelfLife getShelfLife() {
|
||||
return shelfLife;
|
||||
}
|
||||
|
||||
public void setShelfLife(ShelfLife v) {
|
||||
this.shelfLife = v;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Embeddable;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
@Embeddable
|
||||
public class ShelfLife implements java.io.Serializable {
|
||||
private Date inceptionDate;
|
||||
private Date soldDate;
|
||||
|
||||
public ShelfLife() {
|
||||
}
|
||||
|
||||
public ShelfLife(Date inceptionDate, Date soldDate) {
|
||||
this.inceptionDate = inceptionDate;
|
||||
this.soldDate = soldDate;
|
||||
}
|
||||
|
||||
@Basic
|
||||
public Date getInceptionDate() {
|
||||
return inceptionDate;
|
||||
}
|
||||
|
||||
public void setInceptionDate(Date inceptionDate) {
|
||||
this.inceptionDate = inceptionDate;
|
||||
}
|
||||
|
||||
@Basic
|
||||
public Date getSoldDate() {
|
||||
return soldDate;
|
||||
}
|
||||
|
||||
public void setSoldDate(Date soldDate) {
|
||||
this.soldDate = soldDate;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@MappedSuperclass
|
||||
public class SomeMappedSuperclass {
|
||||
private Long id;
|
||||
|
||||
@Id
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
public class SomeMappedSuperclassSubclass extends SomeMappedSuperclass {
|
||||
private String theData;
|
||||
|
||||
public String getTheData() {
|
||||
return theData;
|
||||
}
|
||||
|
||||
public void setTheData(String theData) {
|
||||
this.theData = theData;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
|
||||
/**
|
||||
* TODO : javadoc
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "SPOUSE_TABLE")
|
||||
public class Spouse implements java.io.Serializable {
|
||||
private String id;
|
||||
private String first;
|
||||
private String maiden;
|
||||
private String last;
|
||||
private String sNumber;
|
||||
private Info info;
|
||||
private Customer customer;
|
||||
|
||||
public Spouse() {
|
||||
}
|
||||
|
||||
public Spouse(
|
||||
String v1, String v2, String v3, String v4,
|
||||
String v5, Info v6) {
|
||||
id = v1;
|
||||
first = v2;
|
||||
maiden = v3;
|
||||
last = v4;
|
||||
sNumber = v5;
|
||||
info = v6;
|
||||
}
|
||||
|
||||
|
||||
public Spouse(
|
||||
String v1, String v2, String v3, String v4,
|
||||
String v5, Info v6, Customer v7) {
|
||||
id = v1;
|
||||
first = v2;
|
||||
maiden = v3;
|
||||
last = v4;
|
||||
sNumber = v5;
|
||||
info = v6;
|
||||
customer = v7;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "ID")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String v) {
|
||||
id = v;
|
||||
}
|
||||
|
||||
@Column(name = "FIRSTNAME")
|
||||
public String getFirstName() {
|
||||
return first;
|
||||
}
|
||||
|
||||
public void setFirstName(String v) {
|
||||
first = v;
|
||||
}
|
||||
|
||||
@Column(name = "MAIDENNAME")
|
||||
public String getMaidenName() {
|
||||
return maiden;
|
||||
}
|
||||
|
||||
public void setMaidenName(String v) {
|
||||
maiden = v;
|
||||
}
|
||||
|
||||
@Column(name = "LASTNAME")
|
||||
public String getLastName() {
|
||||
return last;
|
||||
}
|
||||
|
||||
public void setLastName(String v) {
|
||||
last = v;
|
||||
}
|
||||
|
||||
@Column(name = "SOCSECNUM")
|
||||
public String getSocialSecurityNumber() {
|
||||
return sNumber;
|
||||
}
|
||||
|
||||
public void setSocialSecurityNumber(String v) {
|
||||
sNumber = v;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "FK_FOR_INFO_TABLE")
|
||||
public Info getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setInfo(Info v) {
|
||||
info = v;
|
||||
}
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@JoinColumn(name = "FK7_FOR_CUSTOMER_TABLE")
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer v) {
|
||||
customer = v;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Inheritance;
|
||||
import jakarta.persistence.InheritanceType;
|
||||
|
||||
/**
|
||||
* @author James Gilbertson
|
||||
*/
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
public class Thing {
|
||||
private String id;
|
||||
private String name;
|
||||
|
||||
@Id
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
|
||||
/**
|
||||
* @author James Gilbertson
|
||||
*/
|
||||
@Entity
|
||||
public class ThingWithQuantity extends Thing {
|
||||
private int quantity;
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "translation_tbl")
|
||||
public class Translation {
|
||||
@Id
|
||||
Integer id;
|
||||
String title;
|
||||
String text;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.jpamodelgen.test.fromcore;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Version;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Entity
|
||||
public class VersionedEntity {
|
||||
private String id;
|
||||
private String name;
|
||||
private int version;
|
||||
|
||||
@Id
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Version
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue