|
13 | 13 | import javax.persistence.Id; |
14 | 14 | import javax.persistence.Table; |
15 | 15 |
|
16 | | -import org.hibernate.Session; |
17 | | -import org.hibernate.Transaction; |
| 16 | +import org.hibernate.dialect.Oracle12cDialect; |
18 | 17 |
|
19 | 18 | import org.hibernate.testing.DialectChecks; |
20 | 19 | import org.hibernate.testing.RequiresDialectFeature; |
| 20 | +import org.hibernate.testing.SkipForDialect; |
21 | 21 | import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; |
22 | 22 | import org.junit.Test; |
23 | 23 |
|
| 24 | +import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; |
24 | 25 | import static org.junit.Assert.assertNotNull; |
25 | 26 |
|
26 | 27 | /** |
27 | 28 | * @author Vlad Mihalcea |
28 | 29 | */ |
29 | 30 | @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") |
30 | 32 | public class QuotedIdentifierTest extends BaseCoreFunctionalTestCase { |
31 | 33 |
|
32 | 34 | @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 | + } ); |
42 | 42 |
|
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 | + } ); |
49 | 47 | } |
50 | 48 |
|
51 | 49 | @Override |
|
0 commit comments