mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-03-02 15:59:18 +00:00
HHH-6525 : Integrate Set-style plural attributes into persisters
This commit is contained in:
parent
c4d48cfcb6
commit
bd0fcdd2f7
@ -761,7 +761,7 @@ public AbstractCollectionPersister(
|
|||||||
else {
|
else {
|
||||||
org.hibernate.metamodel.spi.relational.Column col = (org.hibernate.metamodel.spi.relational.Column) value;
|
org.hibernate.metamodel.spi.relational.Column col = (org.hibernate.metamodel.spi.relational.Column) value;
|
||||||
elementColumnNames[j] = col.getColumnName().encloseInQuotesIfQuoted( dialect );
|
elementColumnNames[j] = col.getColumnName().encloseInQuotesIfQuoted( dialect );
|
||||||
elementColumnWriters[j] = col.getWriteFragment();
|
elementColumnWriters[j] = col.getWriteFragment() == null ? "?" : col.getWriteFragment();
|
||||||
elementColumnReaders[j] = col.getReadFragment() == null ?
|
elementColumnReaders[j] = col.getReadFragment() == null ?
|
||||||
col.getColumnName().encloseInQuotesIfQuoted( factory.getDialect() ) :
|
col.getColumnName().encloseInQuotesIfQuoted( factory.getDialect() ) :
|
||||||
col.getReadFragment();
|
col.getReadFragment();
|
||||||
|
@ -33,9 +33,10 @@
|
|||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.testing.FailureExpected;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,22 +54,24 @@ public void configure(Configuration cfg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FailureExpected( jiraKey = "HHH-6525")
|
|
||||||
public void testLoad() throws HibernateException, SQLException {
|
public void testLoad() throws HibernateException, SQLException {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
Transaction t = s.beginTransaction();
|
Transaction t = s.beginTransaction();
|
||||||
User u = new User( );
|
User u = new User( );
|
||||||
u.setUserName( "username" );
|
u.setUserName( "username" );
|
||||||
u.getSessionAttributeNames().add( "name" );
|
u.getSessionAttributeNames().add( "name" );
|
||||||
|
u.getSessionAttributeNames().add( "anothername" );
|
||||||
s.save( u );
|
s.save( u );
|
||||||
t.commit();
|
t.commit();
|
||||||
s.close();
|
s.close();
|
||||||
s = openSession();
|
s = openSession();
|
||||||
t = s.beginTransaction();
|
t = s.beginTransaction();
|
||||||
u = (User) s.get( User.class, "name" );
|
u = (User) s.get( User.class, "username" );
|
||||||
|
assertFalse( Hibernate.isInitialized( u.getSessionAttributeNames() ) );
|
||||||
u.getSessionAttributeNames().add( "bar" );
|
assertEquals( 2, u.getSessionAttributeNames().size() );
|
||||||
assertTrue( Hibernate.isInitialized( u.getSessionAttributeNames() ) );
|
assertTrue( Hibernate.isInitialized( u.getSessionAttributeNames() ) );
|
||||||
|
assertTrue( u.getSessionAttributeNames().contains( "name" ) );
|
||||||
|
assertTrue( u.getSessionAttributeNames().contains( "anothername" ) );
|
||||||
s.delete( u );
|
s.delete( u );
|
||||||
t.commit();
|
t.commit();
|
||||||
s.close();
|
s.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user