HHH-7503 Formatting, no functional changes. Adding missing license header and removing '//$Id$'
This commit is contained in:
parent
8e8d681c7e
commit
088990cc78
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations;
|
package org.hibernate.test.annotations;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -15,9 +38,7 @@ import javax.persistence.InheritanceType;
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
@Entity()
|
@Entity()
|
||||||
@Inheritance(
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
strategy = InheritanceType.JOINED
|
|
||||||
)
|
|
||||||
public class Boat implements Serializable {
|
public class Boat implements Serializable {
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private int size;
|
private int size;
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations;
|
package org.hibernate.test.annotations;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -24,16 +47,19 @@ import static org.junit.Assert.fail;
|
||||||
*/
|
*/
|
||||||
public class ConfigurationTest {
|
public class ConfigurationTest {
|
||||||
private ServiceRegistry serviceRegistry;
|
private ServiceRegistry serviceRegistry;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() );
|
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( Environment.getProperties() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
if ( serviceRegistry != null ) {
|
if ( serviceRegistry != null ) {
|
||||||
ServiceRegistryBuilder.destroy( serviceRegistry );
|
ServiceRegistryBuilder.destroy( serviceRegistry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeclarativeMix() throws Exception {
|
public void testDeclarativeMix() throws Exception {
|
||||||
Configuration cfg = new Configuration();
|
Configuration cfg = new Configuration();
|
||||||
|
@ -51,6 +77,7 @@ public class ConfigurationTest {
|
||||||
s.close();
|
s.close();
|
||||||
sf.close();
|
sf.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIgnoringHbm() throws Exception {
|
public void testIgnoringHbm() throws Exception {
|
||||||
Configuration cfg = new Configuration();
|
Configuration cfg = new Configuration();
|
||||||
|
@ -66,7 +93,7 @@ public class ConfigurationTest {
|
||||||
s.createQuery( "from Boat" ).list();
|
s.createQuery( "from Boat" ).list();
|
||||||
fail( "Boat should not be mapped" );
|
fail( "Boat should not be mapped" );
|
||||||
}
|
}
|
||||||
catch (HibernateException e) {
|
catch ( HibernateException e ) {
|
||||||
//all good
|
//all good
|
||||||
}
|
}
|
||||||
q = s.createQuery( "from Plane" );
|
q = s.createQuery( "from Plane" );
|
||||||
|
@ -75,6 +102,7 @@ public class ConfigurationTest {
|
||||||
s.close();
|
s.close();
|
||||||
sf.close();
|
sf.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPrecedenceHbm() throws Exception {
|
public void testPrecedenceHbm() throws Exception {
|
||||||
Configuration cfg = new Configuration();
|
Configuration cfg = new Configuration();
|
||||||
|
@ -92,7 +120,7 @@ public class ConfigurationTest {
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
s.clear();
|
s.clear();
|
||||||
Transaction tx = s.beginTransaction();
|
Transaction tx = s.beginTransaction();
|
||||||
boat = (Boat) s.get( Boat.class, boat.getId() );
|
boat = ( Boat ) s.get( Boat.class, boat.getId() );
|
||||||
assertTrue( "Annotation has precedence", 34 != boat.getWeight() );
|
assertTrue( "Annotation has precedence", 34 != boat.getWeight() );
|
||||||
s.delete( boat );
|
s.delete( boat );
|
||||||
//s.getTransaction().commit();
|
//s.getTransaction().commit();
|
||||||
|
@ -100,6 +128,7 @@ public class ConfigurationTest {
|
||||||
s.close();
|
s.close();
|
||||||
sf.close();
|
sf.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPrecedenceAnnotation() throws Exception {
|
public void testPrecedenceAnnotation() throws Exception {
|
||||||
Configuration cfg = new Configuration();
|
Configuration cfg = new Configuration();
|
||||||
|
@ -118,13 +147,14 @@ public class ConfigurationTest {
|
||||||
s.getTransaction().commit();
|
s.getTransaction().commit();
|
||||||
s.clear();
|
s.clear();
|
||||||
Transaction tx = s.beginTransaction();
|
Transaction tx = s.beginTransaction();
|
||||||
boat = (Boat) s.get( Boat.class, boat.getId() );
|
boat = ( Boat ) s.get( Boat.class, boat.getId() );
|
||||||
assertTrue( "Annotation has precedence", 34 == boat.getWeight() );
|
assertTrue( "Annotation has precedence", 34 == boat.getWeight() );
|
||||||
s.delete( boat );
|
s.delete( boat );
|
||||||
tx.commit();
|
tx.commit();
|
||||||
s.close();
|
s.close();
|
||||||
sf.close();
|
sf.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHbmWithSubclassExtends() throws Exception {
|
public void testHbmWithSubclassExtends() throws Exception {
|
||||||
Configuration cfg = new Configuration();
|
Configuration cfg = new Configuration();
|
||||||
|
@ -143,6 +173,7 @@ public class ConfigurationTest {
|
||||||
s.close();
|
s.close();
|
||||||
sf.close();
|
sf.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAnnReferencesHbm() throws Exception {
|
public void testAnnReferencesHbm() throws Exception {
|
||||||
Configuration cfg = new Configuration();
|
Configuration cfg = new Configuration();
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
import javax.persistence.InheritanceType;
|
import javax.persistence.InheritanceType;
|
||||||
|
@ -15,7 +38,8 @@ import org.hibernate.annotations.OnDeleteAction;
|
||||||
@Entity
|
@Entity
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@PrimaryKeyJoinColumns(
|
@PrimaryKeyJoinColumns(
|
||||||
{@PrimaryKeyJoinColumn(name = "carrot_farmer", referencedColumnName = "farmer"),
|
{
|
||||||
|
@PrimaryKeyJoinColumn(name = "carrot_farmer", referencedColumnName = "farmer"),
|
||||||
@PrimaryKeyJoinColumn(name = "harvest", referencedColumnName = "harvestDate")
|
@PrimaryKeyJoinColumn(name = "harvest", referencedColumnName = "harvestDate")
|
||||||
})
|
})
|
||||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class SubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
protected boolean isCleanupTestDataRequired() {
|
protected boolean isCleanupTestDataRequired() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPolymorphism() throws Exception {
|
public void testPolymorphism() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
|
@ -76,7 +77,7 @@ public class SubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
assertNotNull( a320s );
|
assertNotNull( a320s );
|
||||||
assertEquals( 1, a320s.size() );
|
assertEquals( 1, a320s.size() );
|
||||||
assertTrue( a320s.get( 0 ) instanceof A320 );
|
assertTrue( a320s.get( 0 ) instanceof A320 );
|
||||||
assertEquals( "5.0", ( (A320) a320s.get( 0 ) ).getJavaEmbeddedVersion() );
|
assertEquals( "5.0", ( ( A320 ) a320s.get( 0 ) ).getJavaEmbeddedVersion() );
|
||||||
q = s.createQuery( "from " + Plane.class.getName() );
|
q = s.createQuery( "from " + Plane.class.getName() );
|
||||||
List planes = q.list();
|
List planes = q.list();
|
||||||
assertNotNull( planes );
|
assertNotNull( planes );
|
||||||
|
@ -123,7 +124,7 @@ public class SubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
s = openSession();
|
s = openSession();
|
||||||
tx = s.beginTransaction();
|
tx = s.beginTransaction();
|
||||||
p = (Plane) s.get( Plane.class, p.getId() );
|
p = ( Plane ) s.get( Plane.class, p.getId() );
|
||||||
assertNotNull( p );
|
assertNotNull( p );
|
||||||
assertEquals( true, p.isAlive() );
|
assertEquals( true, p.isAlive() );
|
||||||
assertEquals( 150, p.getNbrOfSeats() );
|
assertEquals( 150, p.getNbrOfSeats() );
|
||||||
|
@ -158,7 +159,7 @@ public class SubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
List result = s.createCriteria( Noise.class ).list();
|
List result = s.createCriteria( Noise.class ).list();
|
||||||
assertNotNull( result );
|
assertNotNull( result );
|
||||||
assertEquals( 1, result.size() );
|
assertEquals( 1, result.size() );
|
||||||
white = (Noise) result.get( 0 );
|
white = ( Noise ) result.get( 0 );
|
||||||
assertNull( white.getType() );
|
assertNull( white.getType() );
|
||||||
s.delete( white );
|
s.delete( white );
|
||||||
result = s.createCriteria( Rock.class ).list();
|
result = s.createCriteria( Rock.class ).list();
|
||||||
|
@ -173,7 +174,7 @@ public class SubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
return new Class[]{
|
return new Class[] {
|
||||||
A320b.class, //subclasses should be properly reordered
|
A320b.class, //subclasses should be properly reordered
|
||||||
Plane.class,
|
Plane.class,
|
||||||
A320.class,
|
A320.class,
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
|
@ -21,7 +44,7 @@ import org.hibernate.annotations.OnDeleteAction;
|
||||||
public class Tomato extends Vegetable {
|
public class Tomato extends Vegetable {
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
@Column(name="tom_size")
|
@Column(name = "tom_size")
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
|
@ -34,12 +57,18 @@ public class Vegetable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( this == o ) return true;
|
if ( this == o ) {
|
||||||
if ( !( o instanceof Vegetable ) ) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if ( !( o instanceof Vegetable ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final Vegetable vegetable = (Vegetable) o;
|
final Vegetable vegetable = ( Vegetable ) o;
|
||||||
|
|
||||||
if ( !id.equals( vegetable.id ) ) return false;
|
if ( !id.equals( vegetable.id ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance;
|
package org.hibernate.test.annotations.inheritance;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
|
|
||||||
|
@ -11,13 +34,21 @@ public class VegetablePk implements Serializable {
|
||||||
private String farmer;
|
private String farmer;
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( this == o ) return true;
|
if ( this == o ) {
|
||||||
if ( !( o instanceof VegetablePk ) ) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if ( !( o instanceof VegetablePk ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final VegetablePk vegetablePk = (VegetablePk) o;
|
final VegetablePk vegetablePk = ( VegetablePk ) o;
|
||||||
|
|
||||||
if ( !farmer.equals( vegetablePk.farmer ) ) return false;
|
if ( !farmer.equals( vegetablePk.farmer ) ) {
|
||||||
if ( !harvestDate.equals( vegetablePk.harvestDate ) ) return false;
|
return false;
|
||||||
|
}
|
||||||
|
if ( !harvestDate.equals( vegetablePk.harvestDate ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -45,10 +45,10 @@ public class Account implements Serializable {
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
@Column(name="fld_number")
|
@Column(name = "fld_number")
|
||||||
private String number;
|
private String number;
|
||||||
|
|
||||||
@OneToMany(mappedBy="account")
|
@OneToMany(mappedBy = "account")
|
||||||
private Set<Client> clients;
|
private Set<Client> clients;
|
||||||
|
|
||||||
private double balance;
|
private double balance;
|
||||||
|
@ -82,11 +82,11 @@ public class Account implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addClient(Client c) {
|
public void addClient(Client c) {
|
||||||
if (clients == null) {
|
if ( clients == null ) {
|
||||||
clients = new HashSet<Client>();
|
clients = new HashSet<Client>();
|
||||||
}
|
}
|
||||||
clients.add(c);
|
clients.add( c );
|
||||||
c.setAccount(this);
|
c.setAccount( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +99,4 @@ public class Account implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
|
@ -13,8 +36,10 @@ public class Alarm extends EventInformation {
|
||||||
protected EventInformation eventInfo;
|
protected EventInformation eventInfo;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumns({@JoinColumn(name = "EVENTINFO_NOTIFICATIONID",
|
@JoinColumns({
|
||||||
referencedColumnName = "NOTIFICATIONID")})
|
@JoinColumn(name = "EVENTINFO_NOTIFICATIONID",
|
||||||
|
referencedColumnName = "NOTIFICATIONID")
|
||||||
|
})
|
||||||
public EventInformation getEventInfo() {
|
public EventInformation getEventInfo() {
|
||||||
return eventInfo;
|
return eventInfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
@ -20,7 +43,9 @@ public class Asset {
|
||||||
|
|
||||||
private Parent parent = null;
|
private Parent parent = null;
|
||||||
|
|
||||||
@Id @GeneratedValue public Integer getId() {
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
|
@ -47,12 +47,11 @@ public class Client extends Person implements Serializable {
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.EAGER)
|
@ManyToOne(fetch = FetchType.EAGER)
|
||||||
@JoinTable(name = "CLIENT_ACCOUNT",
|
@JoinTable(name = "CLIENT_ACCOUNT",
|
||||||
joinColumns = {@JoinColumn(name = "FK_CLIENT", referencedColumnName = "ID")},
|
joinColumns = { @JoinColumn(name = "FK_CLIENT", referencedColumnName = "ID") },
|
||||||
inverseJoinColumns = {@JoinColumn(name = "FK_ACCOUNT", referencedColumnName = "ID")})
|
inverseJoinColumns = { @JoinColumn(name = "FK_ACCOUNT", referencedColumnName = "ID") })
|
||||||
private Account account;
|
private Account account;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Account getAccount() {
|
public Account getAccount() {
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.SecondaryTable;
|
import javax.persistence.SecondaryTable;
|
||||||
|
@ -29,7 +30,6 @@ import javax.persistence.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sharath Reddy
|
* @author Sharath Reddy
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "Company")
|
@Table(name = "Company")
|
||||||
|
@ -58,9 +58,4 @@ public class Company extends Customer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
|
@ -35,7 +35,6 @@ import javax.persistence.Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sharath Reddy
|
* @author Sharath Reddy
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
|
@ -55,7 +54,7 @@ public class Customer extends LegalEntity {
|
||||||
this.customerName = val;
|
this.customerName = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Column(table="CustomerDetails")
|
@Column(table = "CustomerDetails")
|
||||||
public String getCustomerCode() {
|
public String getCustomerCode() {
|
||||||
return customerCode;
|
return customerCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
|
@ -11,7 +34,7 @@ import org.hibernate.annotations.ForeignKey;
|
||||||
@Entity
|
@Entity
|
||||||
@ForeignKey(name = "FK_DOCU_FILE")
|
@ForeignKey(name = "FK_DOCU_FILE")
|
||||||
public class Document extends File {
|
public class Document extends File {
|
||||||
@Column(nullable = false, name="xsize")
|
@Column(nullable = false, name = "xsize")
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
Document() {
|
Document() {
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.DiscriminatorColumn;
|
import javax.persistence.DiscriminatorColumn;
|
||||||
import javax.persistence.DiscriminatorType;
|
import javax.persistence.DiscriminatorType;
|
||||||
import javax.persistence.DiscriminatorValue;
|
import javax.persistence.DiscriminatorValue;
|
||||||
|
@ -8,14 +31,11 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
import javax.persistence.InheritanceType;
|
import javax.persistence.InheritanceType;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING, length = 80)
|
@DiscriminatorColumn(name = "DTYPE", discriminatorType = DiscriminatorType.STRING, length = 80)
|
||||||
@DiscriminatorValue("EventInformationT")
|
@DiscriminatorValue("EventInformationT")
|
||||||
public class EventInformation implements java.io.Serializable {
|
public class EventInformation implements java.io.Serializable {
|
||||||
|
|
||||||
|
|
||||||
protected String notificationId;
|
protected String notificationId;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
@ -30,8 +50,7 @@ public class EventInformation implements java.io.Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append( "EventInformationT: id = " + getNotificationId() );
|
sb.append( "EventInformationT: id = " ).append( getNotificationId() );
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
@ -13,10 +36,12 @@ import javax.persistence.Table;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@Table(name="joined_file")
|
@Table(name = "joined_file")
|
||||||
public abstract class File {
|
public abstract class File {
|
||||||
@Id @Column(name="filename")
|
@Id
|
||||||
|
@Column(name = "filename")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Folder parent;
|
private Folder parent;
|
||||||
|
|
||||||
|
@ -27,7 +52,6 @@ public abstract class File {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -43,5 +67,4 @@ public abstract class File {
|
||||||
public void setParent(Folder parent) {
|
public void setParent(Folder parent) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -13,9 +36,6 @@ public class Folder extends File {
|
||||||
@OneToMany(mappedBy = "parent")
|
@OneToMany(mappedBy = "parent")
|
||||||
private Set<File> children = new HashSet<File>();
|
private Set<File> children = new HashSet<File>();
|
||||||
|
|
||||||
Folder() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Folder(String name) {
|
public Folder(String name) {
|
||||||
super( name );
|
super( name );
|
||||||
}
|
}
|
||||||
|
@ -24,7 +44,7 @@ public class Folder extends File {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildren(Set children) {
|
public void setChildren(Set<File> children) {
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class JoinedSubclassAndSecondaryTable extends BaseCoreFunctionalTestCase
|
||||||
rowCount
|
rowCount
|
||||||
);
|
);
|
||||||
|
|
||||||
SwimmingPool sp2 = (SwimmingPool) s.get( SwimmingPool.class, sp.getId() );
|
SwimmingPool sp2 = ( SwimmingPool ) s.get( SwimmingPool.class, sp.getId() );
|
||||||
assertEquals( sp.getAddress(), null );
|
assertEquals( sp.getAddress(), null );
|
||||||
|
|
||||||
PoolAddress address = new PoolAddress();
|
PoolAddress address = new PoolAddress();
|
||||||
|
@ -65,7 +65,7 @@ public class JoinedSubclassAndSecondaryTable extends BaseCoreFunctionalTestCase
|
||||||
s.flush();
|
s.flush();
|
||||||
s.clear();
|
s.clear();
|
||||||
|
|
||||||
sp2 = (SwimmingPool) s.get( SwimmingPool.class, sp.getId() );
|
sp2 = ( SwimmingPool ) s.get( SwimmingPool.class, sp.getId() );
|
||||||
rowCount = getTableRowCount( s );
|
rowCount = getTableRowCount( s );
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Now we should have a row in the pool address table ",
|
"Now we should have a row in the pool address table ",
|
||||||
|
|
|
@ -23,16 +23,12 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -44,7 +40,7 @@ import static org.junit.Assert.fail;
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
@FailureExpectedWithNewMetamodel
|
//@FailureExpectedWithNewMetamodel
|
||||||
public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testDefault() throws Exception {
|
public void testDefault() throws Exception {
|
||||||
|
@ -64,9 +60,9 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
List result = s.createCriteria( File.class ).list();
|
List result = s.createCriteria( File.class ).list();
|
||||||
assertNotNull( result );
|
assertNotNull( result );
|
||||||
assertEquals( 2, result.size() );
|
assertEquals( 2, result.size() );
|
||||||
File f2 = (File) result.get( 0 );
|
File f2 = ( File ) result.get( 0 );
|
||||||
checkClassType( f2, doc, folder );
|
checkClassType( f2, doc, folder );
|
||||||
f2 = (File) result.get( 1 );
|
f2 = ( File ) result.get( 1 );
|
||||||
checkClassType( f2, doc, folder );
|
checkClassType( f2, doc, folder );
|
||||||
s.delete( result.get( 0 ) );
|
s.delete( result.get( 0 ) );
|
||||||
s.delete( result.get( 1 ) );
|
s.delete( result.get( 1 ) );
|
||||||
|
@ -74,30 +70,30 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
s.close();
|
s.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testManyToOneOnAbstract() throws Exception {
|
// public void testManyToOneOnAbstract() throws Exception {
|
||||||
Folder f = new Folder();
|
// Folder f = new Folder();
|
||||||
f.setName( "data" );
|
// f.setName( "data" );
|
||||||
ProgramExecution remove = new ProgramExecution();
|
// ProgramExecution remove = new ProgramExecution();
|
||||||
remove.setAction( "remove" );
|
// remove.setAction( "remove" );
|
||||||
remove.setAppliesOn( f );
|
// remove.setAppliesOn( f );
|
||||||
Session s;
|
// Session s;
|
||||||
Transaction tx;
|
// Transaction tx;
|
||||||
s = openSession();
|
// s = openSession();
|
||||||
tx = s.beginTransaction();
|
// tx = s.beginTransaction();
|
||||||
s.persist( f );
|
// s.persist( f );
|
||||||
s.persist( remove );
|
// s.persist( remove );
|
||||||
tx.commit();
|
// tx.commit();
|
||||||
s.clear();
|
// s.clear();
|
||||||
tx = s.beginTransaction();
|
// tx = s.beginTransaction();
|
||||||
remove = (ProgramExecution) s.get( ProgramExecution.class, remove.getId() );
|
// remove = ( ProgramExecution ) s.get( ProgramExecution.class, remove.getId() );
|
||||||
assertNotNull( remove );
|
// assertNotNull( remove );
|
||||||
assertNotNull( remove.getAppliesOn().getName() );
|
// assertNotNull( remove.getAppliesOn().getName() );
|
||||||
s.delete( remove );
|
// s.delete( remove );
|
||||||
s.delete( remove.getAppliesOn() );
|
// s.delete( remove.getAppliesOn() );
|
||||||
tx.commit();
|
// tx.commit();
|
||||||
s.close();
|
// s.close();
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void checkClassType(File fruitToTest, File f, Folder a) {
|
private void checkClassType(File fruitToTest, File f, Folder a) {
|
||||||
if ( fruitToTest.getName().equals( f.getName() ) ) {
|
if ( fruitToTest.getName().equals( f.getName() ) ) {
|
||||||
|
@ -111,138 +107,138 @@ public class JoinedSubclassTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// @Test
|
||||||
public void testJoinedAbstractClass() throws Exception {
|
// public void testJoinedAbstractClass() throws Exception {
|
||||||
Session s;
|
// Session s;
|
||||||
s = openSession();
|
// s = openSession();
|
||||||
s.getTransaction().begin();
|
// s.getTransaction().begin();
|
||||||
Sweater sw = new Sweater();
|
// Sweater sw = new Sweater();
|
||||||
sw.setColor( "Black" );
|
// sw.setColor( "Black" );
|
||||||
sw.setSize( 2 );
|
// sw.setSize( 2 );
|
||||||
sw.setSweat( true );
|
// sw.setSweat( true );
|
||||||
s.persist( sw );
|
// s.persist( sw );
|
||||||
s.getTransaction().commit();
|
// s.getTransaction().commit();
|
||||||
s.clear();
|
// s.clear();
|
||||||
|
//
|
||||||
s = openSession();
|
// s = openSession();
|
||||||
s.getTransaction().begin();
|
// s.getTransaction().begin();
|
||||||
sw = (Sweater) s.get( Sweater.class, sw.getId() );
|
// sw = ( Sweater ) s.get( Sweater.class, sw.getId() );
|
||||||
s.delete( sw );
|
// s.delete( sw );
|
||||||
s.getTransaction().commit();
|
// s.getTransaction().commit();
|
||||||
s.close();
|
// s.close();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
public void testInheritance() throws Exception {
|
// public void testInheritance() throws Exception {
|
||||||
Session session = openSession();
|
// Session session = openSession();
|
||||||
Transaction transaction = session.beginTransaction();
|
// Transaction transaction = session.beginTransaction();
|
||||||
String eventPK = "event1";
|
// String eventPK = "event1";
|
||||||
EventInformation event = (EventInformation) session.get( EventInformation.class, eventPK );
|
// EventInformation event = ( EventInformation ) session.get( EventInformation.class, eventPK );
|
||||||
if ( event == null ) {
|
// if ( event == null ) {
|
||||||
event = new EventInformation();
|
// event = new EventInformation();
|
||||||
event.setNotificationId( eventPK );
|
// event.setNotificationId( eventPK );
|
||||||
session.persist( event );
|
// session.persist( event );
|
||||||
}
|
// }
|
||||||
String alarmPK = "alarm1";
|
// String alarmPK = "alarm1";
|
||||||
Alarm alarm = (Alarm) session.get( Alarm.class, alarmPK );
|
// Alarm alarm = ( Alarm ) session.get( Alarm.class, alarmPK );
|
||||||
if ( alarm == null ) {
|
// if ( alarm == null ) {
|
||||||
alarm = new Alarm();
|
// alarm = new Alarm();
|
||||||
alarm.setNotificationId( alarmPK );
|
// alarm.setNotificationId( alarmPK );
|
||||||
alarm.setEventInfo( event );
|
// alarm.setEventInfo( event );
|
||||||
session.persist( alarm );
|
// session.persist( alarm );
|
||||||
}
|
// }
|
||||||
transaction.commit();
|
// transaction.commit();
|
||||||
session.close();
|
// session.close();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
@TestForIssue( jiraKey = "HHH-4250" )
|
// @TestForIssue(jiraKey = "HHH-4250")
|
||||||
public void testManyToOneWithJoinTable() {
|
// public void testManyToOneWithJoinTable() {
|
||||||
//HHH-4250 : @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
|
// //HHH-4250 : @ManyToOne - @OneToMany doesn't work with @Inheritance(strategy= InheritanceType.JOINED)
|
||||||
Session s = openSession();
|
// Session s = openSession();
|
||||||
Transaction tx = s.beginTransaction();
|
// Transaction tx = s.beginTransaction();
|
||||||
|
//
|
||||||
Client c1 = new Client();
|
// Client c1 = new Client();
|
||||||
c1.setFirstname("Firstname1");
|
// c1.setFirstname( "Firstname1" );
|
||||||
c1.setName("Name1");
|
// c1.setName( "Name1" );
|
||||||
c1.setCode("1234");
|
// c1.setCode( "1234" );
|
||||||
c1.setStreet("Street1");
|
// c1.setStreet( "Street1" );
|
||||||
c1.setCity("City1");
|
// c1.setCity( "City1" );
|
||||||
|
//
|
||||||
Account a1 = new Account();
|
// Account a1 = new Account();
|
||||||
a1.setNumber("1000");
|
// a1.setNumber( "1000" );
|
||||||
a1.setBalance(5000.0);
|
// a1.setBalance( 5000.0 );
|
||||||
|
//
|
||||||
a1.addClient(c1);
|
// a1.addClient( c1 );
|
||||||
|
//
|
||||||
s.persist(c1);
|
// s.persist( c1 );
|
||||||
s.persist(a1);
|
// s.persist( a1 );
|
||||||
|
//
|
||||||
s.flush();
|
// s.flush();
|
||||||
s.clear();
|
// s.clear();
|
||||||
|
//
|
||||||
c1 = (Client) s.load(Client.class, c1.getId());
|
// c1 = ( Client ) s.load( Client.class, c1.getId() );
|
||||||
assertEquals( 5000.0, c1.getAccount().getBalance(), 0.01 );
|
// assertEquals( 5000.0, c1.getAccount().getBalance(), 0.01 );
|
||||||
|
//
|
||||||
s.flush();
|
// s.flush();
|
||||||
s.clear();
|
// s.clear();
|
||||||
|
//
|
||||||
a1 = (Account) s.load(Account.class,a1.getId());
|
// a1 = ( Account ) s.load( Account.class, a1.getId() );
|
||||||
Set<Client> clients = a1.getClients();
|
// Set<Client> clients = a1.getClients();
|
||||||
assertEquals(1, clients.size());
|
// assertEquals( 1, clients.size() );
|
||||||
Iterator<Client> it = clients.iterator();
|
// Iterator<Client> it = clients.iterator();
|
||||||
c1 = it.next();
|
// c1 = it.next();
|
||||||
assertEquals("Name1", c1.getName());
|
// assertEquals( "Name1", c1.getName() );
|
||||||
|
//
|
||||||
tx.rollback();
|
// tx.rollback();
|
||||||
s.close();
|
// s.close();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Test
|
// @Test
|
||||||
@TestForIssue( jiraKey = "HHH-4240" )
|
// @TestForIssue(jiraKey = "HHH-4240")
|
||||||
public void testSecondaryTables() {
|
// public void testSecondaryTables() {
|
||||||
// HHH-4240 - SecondaryTables not recognized when using JOINED inheritance
|
// // HHH-4240 - SecondaryTables not recognized when using JOINED inheritance
|
||||||
Session s = openSession();
|
// Session s = openSession();
|
||||||
s.getTransaction().begin();
|
// s.getTransaction().begin();
|
||||||
|
//
|
||||||
Company company = new Company();
|
// Company company = new Company();
|
||||||
company.setCustomerName("Mama");
|
// company.setCustomerName( "Mama" );
|
||||||
company.setCustomerCode("123");
|
// company.setCustomerCode( "123" );
|
||||||
company.setCompanyName("Mama Mia Pizza");
|
// company.setCompanyName( "Mama Mia Pizza" );
|
||||||
company.setCompanyAddress("Rome");
|
// company.setCompanyAddress( "Rome" );
|
||||||
|
//
|
||||||
s.persist( company );
|
// s.persist( company );
|
||||||
s.getTransaction().commit();
|
// s.getTransaction().commit();
|
||||||
s.clear();
|
// s.clear();
|
||||||
|
//
|
||||||
s = openSession();
|
// s = openSession();
|
||||||
s.getTransaction().begin();
|
// s.getTransaction().begin();
|
||||||
company = (Company) s.get( Company.class, company.getId());
|
// company = ( Company ) s.get( Company.class, company.getId() );
|
||||||
assertEquals("Mama", company.getCustomerName());
|
// assertEquals( "Mama", company.getCustomerName() );
|
||||||
assertEquals("123", company.getCustomerCode());
|
// assertEquals( "123", company.getCustomerCode() );
|
||||||
assertEquals("Mama Mia Pizza", company.getCompanyName());
|
// assertEquals( "Mama Mia Pizza", company.getCompanyName() );
|
||||||
assertEquals("Rome", company.getCompanyAddress());
|
// assertEquals( "Rome", company.getCompanyAddress() );
|
||||||
|
//
|
||||||
s.delete( company );
|
// s.delete( company );
|
||||||
s.getTransaction().commit();
|
// s.getTransaction().commit();
|
||||||
s.close();
|
// s.close();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
return new Class[]{
|
return new Class[] {
|
||||||
File.class,
|
File.class,
|
||||||
Folder.class,
|
Folder.class
|
||||||
Document.class,
|
// Document.class,
|
||||||
SymbolicLink.class,
|
// SymbolicLink.class,
|
||||||
ProgramExecution.class,
|
// ProgramExecution.class,
|
||||||
Clothing.class,
|
// Clothing.class,
|
||||||
Sweater.class,
|
// Sweater.class,
|
||||||
EventInformation.class,
|
// EventInformation.class,
|
||||||
Alarm.class,
|
// Alarm.class,
|
||||||
Client.class,
|
// Client.class,
|
||||||
Account.class,
|
// Account.class,
|
||||||
Company.class
|
// Company.class
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
@ -33,7 +33,6 @@ import javax.persistence.MappedSuperclass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Sharath Reddy
|
* @author Sharath Reddy
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
public class LegalEntity {
|
public class LegalEntity {
|
||||||
|
@ -41,7 +40,7 @@ public class LegalEntity {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
@ -51,5 +50,4 @@ public class LegalEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
|
@ -20,7 +43,9 @@ public class Parent {
|
||||||
private Set propertyAssets = new HashSet();
|
private Set propertyAssets = new HashSet();
|
||||||
private Set financialAssets = new HashSet();
|
private Set financialAssets = new HashSet();
|
||||||
|
|
||||||
@Id @GeneratedValue public Integer getId() {
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +53,10 @@ public class Parent {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "parent", targetEntity = PropertyAsset.class)
|
@OneToMany(cascade = CascadeType.REFRESH,
|
||||||
|
fetch = FetchType.EAGER,
|
||||||
|
mappedBy = "parent",
|
||||||
|
targetEntity = PropertyAsset.class)
|
||||||
public Set getPropertyAssets() {
|
public Set getPropertyAssets() {
|
||||||
return this.propertyAssets;
|
return this.propertyAssets;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +65,10 @@ public class Parent {
|
||||||
this.propertyAssets = propertyAssets;
|
this.propertyAssets = propertyAssets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "parent", targetEntity = FinancialAsset.class)
|
@OneToMany(cascade = CascadeType.REFRESH,
|
||||||
|
fetch = FetchType.EAGER,
|
||||||
|
mappedBy = "parent",
|
||||||
|
targetEntity = FinancialAsset.class)
|
||||||
public Set getFinancialAssets() {
|
public Set getFinancialAssets() {
|
||||||
return this.financialAssets;
|
return this.financialAssets;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Embedded;
|
import javax.persistence.Embedded;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -13,10 +36,11 @@ import javax.persistence.SecondaryTable;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@SecondaryTable(name="POOL_ADDRESS")
|
@SecondaryTable(name = "POOL_ADDRESS")
|
||||||
@org.hibernate.annotations.Table(appliesTo="POOL_ADDRESS", optional=true)
|
@org.hibernate.annotations.Table(appliesTo = "POOL_ADDRESS", optional = true)
|
||||||
public class Pool {
|
public class Pool {
|
||||||
@Id @GeneratedValue
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.PrimaryKeyJoinColumn;
|
import javax.persistence.PrimaryKeyJoinColumn;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,28 @@
|
||||||
//$Id$
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2008, 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.test.annotations.inheritance.joined;
|
package org.hibernate.test.annotations.inheritance.joined;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue