Re-enable additional tests

This commit is contained in:
Andrea Boriero 2021-11-25 09:48:44 +01:00 committed by Andrea Boriero
parent 9766b05eba
commit 492d391e73
40 changed files with 554 additions and 545 deletions

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.dataTypes;
package org.hibernate.orm.test.annotations.dataTypes;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
@ -14,84 +14,101 @@ import java.sql.Statement;
import java.util.Date;
import java.util.Locale;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.jdbc.Work;
import org.hibernate.testing.DialectCheck;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.descriptor.JdbcTypeNameMapper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.hibernate.testing.orm.junit.DialectFeatureCheck;
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
import org.hibernate.testing.orm.junit.RequiresDialectFeatureGroup;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Steve Ebersole
*/
@RequiresDialectFeature(value = {DialectChecks.SupportsExpectedLobUsagePattern.class, BasicOperationsTest.OracleDialectChecker.class}, jiraKey = "HHH-6834")
public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
@RequiresDialectFeatureGroup(
value = {
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsExpectedLobUsagePattern.class),
@RequiresDialectFeature(feature = BasicOperationsTest.OracleDialectChecker.class)
},
jiraKey = "HHH-6834"
)
@DomainModel(
annotatedClasses = { SomeEntity.class, SomeOtherEntity.class }
)
@SessionFactory
public class BasicOperationsTest {
private static final String SOME_ENTITY_TABLE_NAME = "SOMEENTITY";
private static final String SOME_OTHER_ENTITY_TABLE_NAME = "SOMEOTHERENTITY";
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[] { SomeEntity.class, SomeOtherEntity.class };
}
public static class OracleDialectChecker implements DialectCheck{
public static class OracleDialectChecker implements DialectFeatureCheck {
@Override
public boolean isMatch(Dialect dialect) {
return ! (dialect instanceof Oracle8iDialect);
public boolean apply(Dialect dialect) {
return !( dialect instanceof OracleDialect );
}
}
@Test
public void testCreateAndDelete() {
public void testCreateAndDelete(SessionFactoryScope scope) {
Date now = new Date();
Session s = openSession();
s.doWork( new ValidateSomeEntityColumns( (SessionImplementor) s ) );
s.doWork( new ValidateRowCount( (SessionImplementor) s, SOME_ENTITY_TABLE_NAME, 0 ) );
s.doWork( new ValidateRowCount( (SessionImplementor) s, SOME_OTHER_ENTITY_TABLE_NAME, 0 ) );
s.beginTransaction();
SomeEntity someEntity = new SomeEntity( now );
SomeOtherEntity someOtherEntity = new SomeOtherEntity( 1 );
s.save( someEntity );
s.save( someOtherEntity );
s.getTransaction().commit();
s.close();
s = openSession();
scope.inTransaction(
session -> {
session.doWork( new ValidateSomeEntityColumns( session ) );
session.doWork( new ValidateRowCount( session, SOME_ENTITY_TABLE_NAME, 0 ) );
session.doWork( new ValidateRowCount( session, SOME_OTHER_ENTITY_TABLE_NAME, 0 ) );
s.doWork( new ValidateRowCount( (SessionImplementor) s, SOME_ENTITY_TABLE_NAME, 1 ) );
s.doWork( new ValidateRowCount( (SessionImplementor) s, SOME_OTHER_ENTITY_TABLE_NAME, 1 ) );
session.save( someEntity );
session.save( someOtherEntity );
}
);
s.beginTransaction();
s.delete( someEntity );
s.delete( someOtherEntity );
s.getTransaction().commit();
scope.inSession(
session -> {
session.doWork( new ValidateRowCount( session, SOME_ENTITY_TABLE_NAME, 1 ) );
session.doWork( new ValidateRowCount( session, SOME_OTHER_ENTITY_TABLE_NAME, 1 ) );
s.doWork( new ValidateRowCount( (SessionImplementor) s, SOME_ENTITY_TABLE_NAME, 0 ) );
s.doWork( new ValidateRowCount( (SessionImplementor) s, SOME_OTHER_ENTITY_TABLE_NAME, 0 ) );
try {
session.beginTransaction();
s.close();
session.delete( someEntity );
session.delete( someOtherEntity );
session.getTransaction().commit();
}
finally {
if ( session.getTransaction().isActive() ) {
session.getTransaction().rollback();
}
}
session.doWork( new ValidateRowCount( session, SOME_ENTITY_TABLE_NAME, 0 ) );
session.doWork( new ValidateRowCount( session, SOME_OTHER_ENTITY_TABLE_NAME, 0 ) );
}
);
}
// verify all the expected columns are created
class ValidateSomeEntityColumns implements Work {
private SessionImplementor s;
public ValidateSomeEntityColumns( SessionImplementor s ) {
public ValidateSomeEntityColumns(SessionImplementor s) {
this.s = s;
}
public void execute(Connection connection) throws SQLException {
// id -> java.util.Date (DATE - becase of explicit TemporalType)
validateColumn( connection, "ID", java.sql.Types.DATE );
@ -113,20 +130,20 @@ public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
String columnNamePattern = generateFinalNamePattern( meta, columnName );
ResultSet columnInfo = meta.getColumns( null, null, tableNamePattern, columnNamePattern );
s.getJdbcCoordinator().getResourceRegistry().register(columnInfo, columnInfo.getStatement());
s.getJdbcCoordinator().getResourceRegistry().register( columnInfo, columnInfo.getStatement() );
assertTrue( columnInfo.next() );
int dataType = columnInfo.getInt( "DATA_TYPE" );
s.getJdbcCoordinator().getResourceRegistry().release( columnInfo, columnInfo.getStatement() );
assertEquals(
columnName,
JdbcTypeNameMapper.getTypeName( expectedJdbcTypeCode ),
JdbcTypeNameMapper.getTypeName( dataType )
JdbcTypeNameMapper.getTypeName( dataType ),
columnName
);
}
private String generateFinalNamePattern(DatabaseMetaData meta, String name) throws SQLException {
if ( meta.storesLowerCaseIdentifiers() ) {
return name.toLowerCase(Locale.ROOT);
return name.toLowerCase( Locale.ROOT );
}
else {
return name;
@ -140,7 +157,7 @@ public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
private final String table;
private SessionImplementor s;
public ValidateRowCount(SessionImplementor s, String table, int count) {
this.s = s;
this.expectedRowCount = count;
@ -150,10 +167,13 @@ public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
public void execute(Connection connection) throws SQLException {
Statement st = s.getJdbcCoordinator().getStatementPreparer().createStatement();
s.getJdbcCoordinator().getResultSetReturn().extract( st, "SELECT COUNT(*) FROM " + table );
ResultSet result = s.getJdbcCoordinator().getResultSetReturn().extract( st, "SELECT COUNT(*) FROM " + table );
ResultSet result = s.getJdbcCoordinator().getResultSetReturn().extract(
st,
"SELECT COUNT(*) FROM " + table
);
result.next();
int rowCount = result.getInt( 1 );
assertEquals( "Unexpected row count", expectedRowCount, rowCount );
assertEquals( expectedRowCount, rowCount, "Unexpected row count" );
}
}
}

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.dataTypes;
package org.hibernate.orm.test.annotations.dataTypes;
/**

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.dataTypes;
package org.hibernate.orm.test.annotations.dataTypes;
import java.util.Date;
import jakarta.persistence.Access;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.dataTypes;
package org.hibernate.orm.test.annotations.dataTypes;
import jakarta.persistence.Access;
import jakarta.persistence.AccessType;

View File

@ -4,9 +4,18 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.notfound;
package org.hibernate.orm.test.annotations.notfound;
import java.io.Serializable;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import jakarta.persistence.ConstraintMode;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
@ -16,43 +25,40 @@ import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertNull;
/**
* @author Emmanuel Bernard
* @author Gail Badner
*/
public class NotFoundLogicalOneToOneTest extends BaseCoreFunctionalTestCase {
@DomainModel(
annotatedClasses = { NotFoundLogicalOneToOneTest.Coin.class, NotFoundLogicalOneToOneTest.Currency.class }
)
@SessionFactory
public class NotFoundLogicalOneToOneTest {
@Test
public void testLogicalOneToOne() throws Exception {
public void testLogicalOneToOne(SessionFactoryScope scope) {
Currency euro = new Currency();
euro.setName( "Euro" );
Coin fiveC = new Coin();
fiveC.setName( "Five cents" );
fiveC.setCurrency( euro );
doInHibernate(
this::sessionFactory, session -> {
scope.inTransaction(
session -> {
session.persist( euro );
session.persist( fiveC );
}
);
doInHibernate(
this::sessionFactory, session -> {
session.delete( euro );
}
scope.inTransaction(
session ->
session.delete( euro )
);
doInHibernate(
this::sessionFactory, session -> {
scope.inTransaction(
session -> {
Coin coin = session.get( Coin.class, fiveC.getId() );
assertNull( coin.getCurrency() );
@ -61,11 +67,6 @@ public class NotFoundLogicalOneToOneTest extends BaseCoreFunctionalTestCase {
);
}
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] { Coin.class, Currency.class };
}
@Entity(name = "Coin")
public static class Coin {
private Integer id;

View File

@ -4,7 +4,15 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.notfound;
package org.hibernate.orm.test.annotations.notfound;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
@ -12,35 +20,28 @@ import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.OneToOne;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
/**
* @author Gail Badner
*/
public class NotFoundOneToOneNonInsertableNonUpdateableTest extends BaseCoreFunctionalTestCase {
@DomainModel(
annotatedClasses = {
NotFoundOneToOneNonInsertableNonUpdateableTest.Person.class,
NotFoundOneToOneNonInsertableNonUpdateableTest.PersonInfo.class
}
)
@SessionFactory
public class NotFoundOneToOneNonInsertableNonUpdateableTest {
private static final int ID = 1;
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] {
Person.class,
PersonInfo.class
};
}
@Test
public void testOneToOne() {
public void testOneToOne(SessionFactoryScope scope) {
doInHibernate(
this::sessionFactory, session -> {
scope.inTransaction(
session -> {
Person person = new Person();
person.id = ID;
person.personInfo = new PersonInfo();
@ -49,14 +50,13 @@ public class NotFoundOneToOneNonInsertableNonUpdateableTest extends BaseCoreFunc
}
);
doInHibernate(
this::sessionFactory, session -> {
session.delete( session.get( PersonInfo.class, ID ) );
}
scope.inTransaction(
session ->
session.delete( session.get( PersonInfo.class, ID ) )
);
doInHibernate(
this::sessionFactory, session -> {
scope.inTransaction(
session -> {
Person person = session.get( Person.class, ID );
assertNotNull( person );
assertNull( person.personInfo );
@ -66,7 +66,7 @@ public class NotFoundOneToOneNonInsertableNonUpdateableTest extends BaseCoreFunc
);
}
@Entity(name="Person")
@Entity(name = "Person")
public static class Person {
@Id

View File

@ -4,34 +4,41 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.notfound;
package org.hibernate.orm.test.annotations.notfound;
import java.io.Serializable;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.orm.junit.DialectFeatureChecks;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import static org.junit.jupiter.api.Assertions.assertNull;
import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertNull;
/**
* @author Emmanuel Bernard
*/
@RequiresDialectFeature(value = DialectChecks.SupportsIdentityColumns.class)
public class NotFoundTest extends BaseCoreFunctionalTestCase {
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsIdentityColumns.class)
@DomainModel(
annotatedClasses = { NotFoundTest.Coin.class, NotFoundTest.Currency.class }
)
@SessionFactory
public class NotFoundTest {
@Test
public void testManyToOne() throws Exception {
public void testManyToOne(SessionFactoryScope scope) {
final Currency euro = new Currency();
euro.setName( "Euro" );
@ -39,28 +46,23 @@ public class NotFoundTest extends BaseCoreFunctionalTestCase {
fiveCents.setName( "Five cents" );
fiveCents.setCurrency( euro );
doInHibernate( this::sessionFactory, session -> {
scope.inTransaction( session -> {
session.persist( euro );
session.persist( fiveCents );
} );
doInHibernate( this::sessionFactory, session -> {
scope.inTransaction( session -> {
Currency _euro = session.get( Currency.class, euro.getId() );
session.delete( _euro );
} );
doInHibernate( this::sessionFactory, session -> {
scope.inTransaction( session -> {
Coin _fiveCents = session.get( Coin.class, fiveCents.getId() );
assertNull( _fiveCents.getCurrency() );
session.delete( _fiveCents );
} );
}
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] {Coin.class, Currency.class};
}
@Entity(name = "Coin")
public static class Coin {

View File

@ -4,7 +4,18 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.annotations.notfound;
package org.hibernate.orm.test.annotations.notfound;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
@ -16,47 +27,37 @@ import jakarta.persistence.JoinTable;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
/**
* @author Andrea Boriero
*/
@TestForIssue(jiraKey = "HHH-11591")
public class OneToOneNotFoundTest extends BaseCoreFunctionalTestCase {
@DomainModel(
annotatedClasses = { OneToOneNotFoundTest.Show.class, OneToOneNotFoundTest.ShowDescription.class }
)
@SessionFactory(
exportSchema = false
)
public class OneToOneNotFoundTest {
@Override
protected boolean createSchema() {
return false;
}
@BeforeEach
public void setUp(SessionFactoryScope scope) {
scope.inTransaction(
session ->
session.doWork( connection -> {
connection.createStatement().execute(
"create table SHOW_DESCRIPTION ( ID integer not null, primary key (ID) )" );
connection.createStatement().execute(
"create table T_SHOW ( id integer not null, primary key (id) )" );
connection.createStatement().execute(
"create table TSHOW_SHOWDESCRIPTION ( DESCRIPTION_ID integer, SHOW_ID integer not null, primary key (SHOW_ID) )" );
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] {Show.class, ShowDescription.class};
}
} )
);
@Before
public void setUp() {
doInHibernate( this::sessionFactory, session -> {
session.doWork( connection -> {
connection.createStatement().execute("create table SHOW_DESCRIPTION ( ID integer not null, primary key (ID) )" );
connection.createStatement().execute("create table T_SHOW ( id integer not null, primary key (id) )" );
connection.createStatement().execute("create table TSHOW_SHOWDESCRIPTION ( DESCRIPTION_ID integer, SHOW_ID integer not null, primary key (SHOW_ID) )" );
} );
} );
doInHibernate( this::sessionFactory, session -> {
scope.inTransaction( session -> {
Show show = new Show();
show.setId( 1 );
ShowDescription showDescription = new ShowDescription();
@ -67,29 +68,31 @@ public class OneToOneNotFoundTest extends BaseCoreFunctionalTestCase {
} );
doInHibernate( this::sessionFactory, session -> {
session.doWork( connection -> {
connection.createStatement().execute( "delete from SHOW_DESCRIPTION where ID = 2" );
} );
} );
scope.inTransaction(
session ->
session.doWork( connection ->
connection.createStatement()
.execute( "delete from SHOW_DESCRIPTION where ID = 2" )
)
);
}
@After
public void tearDow() {
doInHibernate( this::sessionFactory, session -> {
session.doWork( connection -> {
connection.createStatement().execute( "drop table TSHOW_SHOWDESCRIPTION" );
connection.createStatement().execute( "drop table SHOW_DESCRIPTION" );
connection.createStatement().execute( "drop table T_SHOW" );
@AfterEach
public void tearDow(SessionFactoryScope scope) {
scope.inTransaction(
session ->
session.doWork( connection -> {
connection.createStatement().execute( "drop table TSHOW_SHOWDESCRIPTION" );
connection.createStatement().execute( "drop table SHOW_DESCRIPTION" );
connection.createStatement().execute( "drop table T_SHOW" );
} );
} );
} )
);
}
@Test
public void testOneToOne() throws Exception {
doInHibernate( this::sessionFactory, session -> {
public void testOneToOne(SessionFactoryScope scope) throws Exception {
scope.inTransaction( session -> {
final Show show2 = session.find( Show.class, 1 );
assertNotNull( show2 );
assertNull( show2.getDescription() );

View File

@ -0,0 +1,67 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.orm.test.query;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
/**
* @author Vlad Mihalcea
*/
@DomainModel(
annotatedClasses = NativeQueryWithParenthesesTest.Person.class
)
@SessionFactory
public class NativeQueryWithParenthesesTest {
@Test
public void testParseParentheses(SessionFactoryScope scope) {
scope.inTransaction(
entityManager ->
entityManager.createNativeQuery(
"(SELECT p.id, p.name FROM Person p WHERE p.name LIKE 'A%') " +
"UNION " +
"(SELECT p.id, p.name FROM Person p WHERE p.name LIKE 'B%')",
Person.class
).getResultList()
);
}
@Entity
@Table(name = "Person")
public static class Person {
@Id
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
import java.util.Date;
import java.util.HashMap;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
public class EwtAssessmentExtension extends SettlementExtension {
public static final long serialVersionUID = 1L;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
import java.util.Date;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
public class GapAssessmentExtension extends SettlementExtension {
public static final long serialVersionUID = 1L;

View File

@ -0,0 +1,92 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.orm.test.query.hhh12076;
import java.util.List;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@TestForIssue(jiraKey = "HHH-12076")
@DomainModel(
xmlMappings = {
"org/hibernate/query/hhh12076/Claim.hbm.xml",
"org/hibernate/query/hhh12076/EwtAssessmentExtension.hbm.xml",
"org/hibernate/query/hhh12076/Extension.hbm.xml",
"org/hibernate/query/hhh12076/GapAssessmentExtension.hbm.xml",
"org/hibernate/query/hhh12076/Settlement.hbm.xml",
"org/hibernate/query/hhh12076/SettlementExtension.hbm.xml",
"org/hibernate/query/hhh12076/SettlementTask.hbm.xml",
"org/hibernate/query/hhh12076/Task.hbm.xml",
"org/hibernate/query/hhh12076/TaskStatus.hbm.xml",
}
)
@SessionFactory
public class HbmMappingJoinClassTest {
@BeforeEach
protected void prepareTest(SessionFactoryScope scope) {
scope.inTransaction( session -> {
TaskStatus taskStatus = new TaskStatus();
taskStatus.setName( "Enabled" );
taskStatus.setDisplayName( "Enabled" );
session.save( taskStatus );
for ( long i = 0; i < 10; i++ ) {
SettlementTask settlementTask = new SettlementTask();
settlementTask.setId( i );
Settlement settlement = new Settlement();
settlementTask.setLinked( settlement );
settlementTask.setStatus( taskStatus );
Claim claim = new Claim();
claim.setId( i );
settlement.setClaim( claim );
for ( int j = 0; j < 2; j++ ) {
GapAssessmentExtension gapAssessmentExtension = new GapAssessmentExtension();
gapAssessmentExtension.setSettlement( settlement );
EwtAssessmentExtension ewtAssessmentExtension = new EwtAssessmentExtension();
ewtAssessmentExtension.setSettlement( settlement );
settlement.getExtensions().add( gapAssessmentExtension );
settlement.getExtensions().add( ewtAssessmentExtension );
}
session.save( claim );
session.save( settlement );
session.save( settlementTask );
}
} );
}
@Test
public void testClassExpressionInOnClause(SessionFactoryScope scope) {
scope.inTransaction( session -> {
List<SettlementTask> results = session.createQuery(
"select " +
" rootAlias.id, " +
" linked.id, " +
" extensions.id " +
"from SettlementTask as rootAlias " +
"join rootAlias.linked as linked " +
"left join linked.extensions as extensions " +
" on extensions.class = org.hibernate.orm.test.query.hhh12076.EwtAssessmentExtension " +
"where linked.id = :claimId" )
.setParameter( "claimId", 1L )
.getResultList();
assertNotNull( results );
} );
}
}

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
import java.util.Date;
import java.util.HashMap;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
import java.util.Date;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
public enum SettlementStatus {
RESERVED, ALLOCATED, PAID, VOID, DENIED

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
public class SettlementTask extends Task<Settlement> {

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
import java.util.Date;
import java.util.HashSet;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12076;
package org.hibernate.orm.test.query.hhh12076;
import java.util.Date;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12225;
package org.hibernate.orm.test.query.hhh12225;
import java.util.Date;

View File

@ -4,43 +4,33 @@
* 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.query.hhh12225;
package org.hibernate.orm.test.query.hhh12225;
import java.util.List;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.jupiter.api.Assertions.assertFalse;
@TestForIssue(jiraKey = "HHH-12225")
public class HQLTypeTest extends BaseCoreFunctionalTestCase {
@Override
protected Class[] getAnnotatedClasses() {
return new Class[] {
};
}
@Override
protected String[] getMappings() {
return new String[] {
"Contract.hbm.xml",
"Vehicle.hbm.xml"
};
}
@Override
protected String getBaseForMappings() {
return "org/hibernate/query/hhh12225/";
}
@DomainModel(
xmlMappings = {
"org/hibernate/orm/test/query/hhh12225/Contract.hbm.xml",
"org/hibernate/orm/test/query/hhh12225/Vehicle.hbm.xml"
}
)
@SessionFactory
public class HQLTypeTest {
@Test
public void test() throws Exception {
VehicleContract contract = doInHibernate( this::sessionFactory, session -> {
public void test(SessionFactoryScope scope) {
VehicleContract contract = scope.fromTransaction( session -> {
VehicleContract firstCotract = null;
for ( long i = 0; i < 10; i++ ) {
VehicleContract vehicleContract = new VehicleContract();
@ -61,24 +51,24 @@ public class HQLTypeTest extends BaseCoreFunctionalTestCase {
return firstCotract;
} );
doInHibernate( this::sessionFactory, session -> {
scope.inTransaction( session -> {
List workingResults = session.createQuery(
"select rootAlias.id from Contract as rootAlias where rootAlias.id = :id" )
"select rootAlias.id from Contract as rootAlias where rootAlias.id = :id" )
.setParameter( "id", contract.getId() )
.getResultList();
assertFalse( workingResults.isEmpty() );
Long workingId = (Long) workingResults.get( 0 );
assertEquals( Long.valueOf( contract.getId() ), workingId );
assertEquals( contract.getId(), workingId );
List failingResults = session.createQuery(
"select rootAlias.id, type(rootAlias) from Contract as rootAlias where rootAlias.id = :id" )
"select rootAlias.id, type(rootAlias) from Contract as rootAlias where rootAlias.id = :id" )
.setParameter( "id", contract.getId() )
.getResultList();
assertFalse( failingResults.isEmpty() );
Long failingId = (Long) ( (Object[]) failingResults.get( 0 ) )[0];
assertEquals( Long.valueOf( contract.getId() ), failingId );
assertEquals( contract.getId(), failingId );
} );
}
}

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12225;
package org.hibernate.orm.test.query.hhh12225;
import java.util.Date;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12225;
package org.hibernate.orm.test.query.hhh12225;
import java.util.ArrayList;
import java.util.List;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.query.hhh12225;
package org.hibernate.orm.test.query.hhh12225;
public class VehicleTrackContract extends VehicleContract {
public static final long serialVersionUID = 1L;

View File

@ -0,0 +1,125 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.orm.test.query.hhh13712;
import java.util.List;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
import org.hibernate.testing.orm.junit.Jpa;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import static org.junit.jupiter.api.Assertions.assertEquals;
@TestForIssue(jiraKey = "HHH-13712")
@Jpa(
annotatedClasses = { HHH13712Test.Super.class, HHH13712Test.SubObject.class, HHH13712Test.SomeOther.class }
)
public class HHH13712Test {
@BeforeAll
public void setUp(EntityManagerFactoryScope scope) {
scope.inTransaction( em -> {
SomeOther a_1 = new SomeOther( 1L );
SomeOther a_2 = new SomeOther( 2L );
SomeOther a_3 = new SomeOther( 3L );
SubObject b_5 = new SubObject( 5L, a_1 );
SubObject b_6 = new SubObject( 6L, a_2 );
SubObject b_7 = new SubObject( 7L, a_3 );
em.merge( a_1 );
em.merge( a_2 );
em.merge( a_3 );
em.merge( b_5 );
em.merge( b_6 );
em.merge( b_7 );
} );
}
@Test
public void testJoinSuperclassAssociationOnly(EntityManagerFactoryScope scope) {
scope.inTransaction( em -> {
List<Integer> actual = em.createQuery( "SELECT 1 FROM SubObject sub LEFT JOIN sub.parent p", Integer.class )
.getResultList();
assertEquals( 3, actual.size() );
} );
}
@Test
public void testJoinSuperclassAssociation(EntityManagerFactoryScope scope) {
scope.inTransaction( em -> {
long actual = em.createQuery(
"SELECT COUNT(sub) FROM SubObject sub LEFT JOIN sub.parent p WHERE p.id = 1",
Long.class
).getSingleResult();
assertEquals( 1L, actual );
} );
}
@Test
public void testCountParentIds(EntityManagerFactoryScope scope) {
scope.inTransaction( em -> {
long actual = em.createQuery( "SELECT COUNT(distinct sub.parent.id) FROM SubObject sub", Long.class )
.getSingleResult();
assertEquals( 3L, actual );
} );
}
@Entity(name = "Super")
@Inheritance(strategy = InheritanceType.JOINED)
public static class Super {
@Id
@Column
Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false)
SomeOther parent;
}
@Entity(name = "SubObject")
public static class SubObject extends Super {
SubObject() {
}
SubObject(Long id, SomeOther parent) {
this.id = id;
this.parent = parent;
}
}
@Entity(name = "SomeOther")
public static class SomeOther {
@Id
@Column
Long id;
SomeOther() {
}
SomeOther(Long id) {
this.id = id;
}
}
}

View File

@ -1,68 +0,0 @@
/*
* 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.query;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
/**
* @author Vlad Mihalcea
*/
public class NativeQueryWithParenthesesTest extends BaseEntityManagerFunctionalTestCase {
@Override
public Class[] getAnnotatedClasses() {
return new Class[] {
Person.class
};
}
@Test
public void testParseParentheses() {
doInJPA( this::entityManagerFactory, entityManager -> {
entityManager.createNativeQuery(
"(SELECT p.id, p.name FROM Person p WHERE p.name LIKE 'A%') " +
"UNION " +
"(SELECT p.id, p.name FROM Person p WHERE p.name LIKE 'B%')", Person.class)
.getResultList();
} );
}
@Entity
@Table(name = "Person")
public static class Person {
@Id
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
}

View File

@ -1,101 +0,0 @@
/*
* 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.query.hhh12076;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@TestForIssue(jiraKey = "HHH-12076")
public class HbmMappingJoinClassTest extends BaseCoreFunctionalTestCase {
@Override
protected String[] getMappings() {
return new String[] {
"Claim.hbm.xml",
"EwtAssessmentExtension.hbm.xml",
"Extension.hbm.xml",
"GapAssessmentExtension.hbm.xml",
"Settlement.hbm.xml",
"SettlementExtension.hbm.xml",
"SettlementTask.hbm.xml",
"Task.hbm.xml",
"TaskStatus.hbm.xml",
};
}
@Override
protected String getBaseForMappings() {
return "org/hibernate/query/hhh12076/";
}
@Override
protected void prepareTest() {
doInHibernate( this::sessionFactory, session -> {
TaskStatus taskStatus = new TaskStatus();
taskStatus.setName("Enabled");
taskStatus.setDisplayName("Enabled");
session.save(taskStatus);
for (long i = 0; i < 10; i++) {
SettlementTask settlementTask = new SettlementTask();
settlementTask.setId(i);
Settlement settlement = new Settlement();
settlementTask.setLinked(settlement);
settlementTask.setStatus(taskStatus);
Claim claim = new Claim();
claim.setId(i);
settlement.setClaim(claim);
for (int j = 0; j < 2; j++) {
GapAssessmentExtension gapAssessmentExtension = new GapAssessmentExtension();
gapAssessmentExtension.setSettlement(settlement);
EwtAssessmentExtension ewtAssessmentExtension = new EwtAssessmentExtension();
ewtAssessmentExtension.setSettlement(settlement);
settlement.getExtensions().add(gapAssessmentExtension);
settlement.getExtensions().add(ewtAssessmentExtension);
}
session.save(claim);
session.save(settlement);
session.save(settlementTask);
}
} );
}
@Test
public void testClassExpressionInOnClause() {
doInHibernate( this::sessionFactory, session -> {
List<SettlementTask> results = session.createQuery(
"select " +
" rootAlias.id, " +
" linked.id, " +
" extensions.id " +
"from SettlementTask as rootAlias " +
"join rootAlias.linked as linked " +
"left join linked.extensions as extensions " +
" on extensions.class = org.hibernate.query.hhh12076.EwtAssessmentExtension " +
"where linked.id = :claimId")
.setParameter("claimId", 1L)
.getResultList();
assertNotNull(results);
} );
}
}

View File

@ -1,122 +0,0 @@
/*
* 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.query.hhh13712;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Before;
import org.junit.Test;
import jakarta.persistence.Column;
import jakarta.persistence.ConstraintMode;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.Id;
import jakarta.persistence.Inheritance;
import jakarta.persistence.InheritanceType;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Tuple;
import java.util.List;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
@TestForIssue(jiraKey = "HHH-13712")
public class HHH13712Test extends BaseCoreFunctionalTestCase {
@Before
public void setUp() {
doInJPA(this::sessionFactory, em -> {
SomeOther a_1 = new SomeOther(1L);
SomeOther a_2 = new SomeOther(2L);
SomeOther a_3 = new SomeOther(3L);
SubObject b_5 = new SubObject(5L, a_1);
SubObject b_6 = new SubObject(6L, a_2);
SubObject b_7 = new SubObject(7L, a_3);
em.merge(a_1);
em.merge(a_2);
em.merge(a_3);
em.merge(b_5);
em.merge(b_6);
em.merge(b_7);
});
}
@Test
public void testJoinSuperclassAssociationOnly() {
doInJPA(this::sessionFactory, em -> {
List<Integer> actual = em.createQuery("SELECT 1 FROM SubObject sub LEFT JOIN sub.parent p", Integer.class).getResultList();
assertEquals(3, actual.size());
});
}
@Test
public void testJoinSuperclassAssociation() {
doInJPA(this::sessionFactory, em -> {
long actual = em.createQuery("SELECT COUNT(sub) FROM SubObject sub LEFT JOIN sub.parent p WHERE p.id = 1", Long.class).getSingleResult();
assertEquals(1L, actual);
});
}
@Test
public void testCountParentIds() {
doInJPA(this::sessionFactory, em -> {
long actual = em.createQuery("SELECT COUNT(distinct sub.parent.id) FROM SubObject sub", Long.class).getSingleResult();
assertEquals(3L, actual);
});
}
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class<?>[] { Super.class, SubObject.class, SomeOther.class };
}
@Entity(name = "Super")
@Inheritance(strategy = InheritanceType.JOINED)
public static class Super {
@Id
@Column
Long id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(nullable = false)
SomeOther parent;
}
@Entity(name = "SubObject")
public static class SubObject extends Super {
SubObject() {}
SubObject(Long id, SomeOther parent) {
this.id = id;
this.parent = parent;
}
}
@Entity(name = "SomeOther")
public static class SomeOther {
@Id
@Column
Long id;
SomeOther() {}
SomeOther(Long id) {
this.id = id;
}
}
}

View File

@ -2,7 +2,7 @@
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.hibernate.query.hhh12225">
<hibernate-mapping package="org.hibernate.orm.test.query.hhh12225">
<class name="Contract" table="contract" >
<meta attribute="class-description">
@ -33,7 +33,7 @@
<meta attribute="validate:min-size">1</meta>
<meta attribute="validate:max-size">1</meta>
<key column="contract_id" />
<one-to-many class="org.hibernate.query.hhh12225.Vehicle" />
<one-to-many class="org.hibernate.orm.test.query.hhh12225.Vehicle" />
</bag>
<joined-subclass name="VehicleTrackContract" table="contract_vehicle_track">
<key column="contract_id" />

View File

@ -2,7 +2,7 @@
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="org.hibernate.query.hhh12225">
<hibernate-mapping package="org.hibernate.orm.test.query.hhh12225">
<class name="Vehicle">
<meta attribute="class-description">

View File

@ -9,7 +9,7 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="org.hibernate.query.hhh12076.Claim"
name="org.hibernate.orm.test.query.hhh12076.Claim"
table="claim"
lazy="false">
@ -68,7 +68,7 @@
<key>
<column name="claim_id" not-null="true"/>
</key>
<one-to-many class="org.hibernate.query.hhh12076.Extension"/>
<one-to-many class="org.hibernate.orm.test.query.hhh12076.Extension"/>
</set>
<set
name="settlements"
@ -80,7 +80,7 @@
<key>
<column name="claim_id" not-null="true"/>
</key>
<one-to-many class="org.hibernate.query.hhh12076.Settlement"/>
<one-to-many class="org.hibernate.orm.test.query.hhh12076.Settlement"/>
</set>
</class>
</hibernate-mapping>

View File

@ -9,8 +9,8 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<joined-subclass
name="org.hibernate.query.hhh12076.EwtAssessmentExtension"
extends="org.hibernate.query.hhh12076.SettlementExtension"
name="org.hibernate.orm.test.query.hhh12076.EwtAssessmentExtension"
extends="org.hibernate.orm.test.query.hhh12076.SettlementExtension"
table="claim_settlement_ext_i3_ewt"
lazy="false">

View File

@ -9,7 +9,7 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="org.hibernate.query.hhh12076.Extension"
name="org.hibernate.orm.test.query.hhh12076.Extension"
table="claim_ext"
lazy="false">
@ -29,7 +29,7 @@
<column name="type" length="128" not-null="true"/>
</property>
<many-to-one name="claim" class="org.hibernate.query.hhh12076.Claim" fetch="select">
<many-to-one name="claim" class="org.hibernate.orm.test.query.hhh12076.Claim" fetch="select">
<column name="claim_id" not-null="true"/>
</many-to-one>
</class>

View File

@ -9,8 +9,8 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<joined-subclass
name="org.hibernate.query.hhh12076.GapAssessmentExtension"
extends="org.hibernate.query.hhh12076.SettlementExtension"
name="org.hibernate.orm.test.query.hhh12076.GapAssessmentExtension"
extends="org.hibernate.orm.test.query.hhh12076.SettlementExtension"
table="claim_settlement_ext_gap"
lazy="false">

View File

@ -9,7 +9,7 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="org.hibernate.query.hhh12076.Settlement"
name="org.hibernate.orm.test.query.hhh12076.Settlement"
table="claim_settlement"
lazy="false">
@ -38,13 +38,13 @@
<column name="status" not-null="true"/>
<type name="org.hibernate.type.EnumType">
<param name="type">12</param>
<param name="enumClass">org.hibernate.query.hhh12076.SettlementStatus</param>
<param name="enumClass">org.hibernate.orm.test.query.hhh12076.SettlementStatus</param>
</type>
</property>
<many-to-one
name="claim"
class="org.hibernate.query.hhh12076.Claim"
class="org.hibernate.orm.test.query.hhh12076.Claim"
fetch="select">
<column name="claim_id" not-null="true"/>
</many-to-one>
@ -57,7 +57,7 @@
batch-size="10"
order-by="order_index">
<key column="settlement_id" not-null="true"/>
<one-to-many class="org.hibernate.query.hhh12076.SettlementExtension"/>
<one-to-many class="org.hibernate.orm.test.query.hhh12076.SettlementExtension"/>
</set>
</class>

View File

@ -9,7 +9,7 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="org.hibernate.query.hhh12076.SettlementExtension"
name="org.hibernate.orm.test.query.hhh12076.SettlementExtension"
table="claim_settlement_ext"
abstract="true"
lazy="false">
@ -31,7 +31,7 @@
<many-to-one
name="settlement"
class="org.hibernate.query.hhh12076.Settlement"
class="org.hibernate.orm.test.query.hhh12076.Settlement"
fetch="select">
<column name="settlement_id" not-null="true"/>
</many-to-one>

View File

@ -9,14 +9,14 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<subclass
name="org.hibernate.query.hhh12076.SettlementTask"
extends="org.hibernate.query.hhh12076.Task"
discriminator-value="org.hibernate.query.hhh12076.SettlementTask"
name="org.hibernate.orm.test.query.hhh12076.SettlementTask"
extends="org.hibernate.orm.test.query.hhh12076.Task"
discriminator-value="org.hibernate.orm.test.query.hhh12076.SettlementTask"
lazy="false">
<many-to-one
name="linked"
class="org.hibernate.query.hhh12076.Settlement"
class="org.hibernate.orm.test.query.hhh12076.Settlement"
fetch="join">
<column name="linked_id" not-null="true"/>
</many-to-one>

View File

@ -9,7 +9,7 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="org.hibernate.query.hhh12076.Task"
name="org.hibernate.orm.test.query.hhh12076.Task"
abstract="true"
table="wf_task"
lazy="false">
@ -54,13 +54,13 @@
</property>
<many-to-one
name="status"
class="org.hibernate.query.hhh12076.TaskStatus"
class="org.hibernate.orm.test.query.hhh12076.TaskStatus"
fetch="select">
<column name="task_status" not-null="true"/>
</many-to-one>
<many-to-one
name="parent"
class="org.hibernate.query.hhh12076.Task"
class="org.hibernate.orm.test.query.hhh12076.Task"
fetch="select">
<column name="parent_id" not-null="false"/>
</many-to-one>
@ -72,7 +72,7 @@
cascade="all,delete-orphan"
batch-size="10">
<key column="parent_id"/>
<one-to-many class="org.hibernate.query.hhh12076.Task"/>
<one-to-many class="org.hibernate.orm.test.query.hhh12076.Task"/>
</set>
<set
name="linkedTasks"
@ -83,7 +83,7 @@
cascade="none">
<key column="task_id"/>
<many-to-many
class="org.hibernate.query.hhh12076.Task"
class="org.hibernate.orm.test.query.hhh12076.Task"
column="link_to_task_id"
/>
</set>

View File

@ -9,7 +9,7 @@
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="org.hibernate.query.hhh12076.TaskStatus"
name="org.hibernate.orm.test.query.hhh12076.TaskStatus"
table="wf_task_status"
lazy="false">