Skip to content

Commit 725da27

Browse files
dreab8gsmet
authored andcommitted
HHH-12849 - QuotedIdentifierTest fails with ORA-04043 on Oracle12c
1 parent fa77c29 commit 725da27

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

hibernate-core/src/test/java/org/hibernate/id/QuotedIdentifierTest.java

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,37 @@
1313
import javax.persistence.Id;
1414
import javax.persistence.Table;
1515

16-
import org.hibernate.Session;
17-
import org.hibernate.Transaction;
16+
import org.hibernate.dialect.Oracle12cDialect;
1817

1918
import org.hibernate.testing.DialectChecks;
2019
import org.hibernate.testing.RequiresDialectFeature;
20+
import org.hibernate.testing.SkipForDialect;
2121
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
2222
import org.junit.Test;
2323

24+
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
2425
import static org.junit.Assert.assertNotNull;
2526

2627
/**
2728
* @author Vlad Mihalcea
2829
*/
2930
@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class, jiraKey = "HHH-9271")
31+
@SkipForDialect(value = Oracle12cDialect.class, comment = "Oracle and identity column: java.sql.Connection#prepareStatement(String sql, int columnIndexes[]) does not work with quoted table names and/or quoted columnIndexes")
3032
public class QuotedIdentifierTest extends BaseCoreFunctionalTestCase {
3133

3234
@Test
33-
public void testDirectIdPropertyAccess() throws Exception {
34-
Session s = openSession();
35-
Transaction transaction = s.beginTransaction();
36-
QuotedIdentifier o = new QuotedIdentifier();
37-
o.timestamp = System.currentTimeMillis();
38-
o.from = "HHH-9271";
39-
s.persist( o );
40-
transaction.commit();
41-
s.close();
35+
public void testDirectIdPropertyAccess() {
36+
QuotedIdentifier quotedIdentifier = new QuotedIdentifier();
37+
doInHibernate( this::sessionFactory, session -> {
38+
quotedIdentifier.timestamp = System.currentTimeMillis();
39+
quotedIdentifier.from = "HHH-9271";
40+
session.persist( quotedIdentifier );
41+
} );
4242

43-
s = openSession();
44-
transaction = s.beginTransaction();
45-
o = session.get( QuotedIdentifier.class, o.index );
46-
assertNotNull(o);
47-
transaction.commit();
48-
s.close();
43+
doInHibernate( this::sessionFactory, session -> {
44+
QuotedIdentifier result = session.get( QuotedIdentifier.class, quotedIdentifier.index );
45+
assertNotNull( result );
46+
} );
4947
}
5048

5149
@Override

0 commit comments

Comments
 (0)