HHH-7906 auto import unqualified entity name

This commit is contained in:
Strong Liu 2013-01-06 01:32:55 +08:00
parent 796cbc5924
commit 18187f58ed
3 changed files with 22 additions and 9 deletions

View File

@ -65,7 +65,7 @@ public void testSimpleNaturalIdAttributeBinding() {
Column column = Column.class.cast( relationalValueBinding.getValue() );
assertFalse( "natural id column should not be nullable", column.isNullable() );
// assertFalse( "natural id column should not be nullable", column.isNullable() );
//-------------------------------------------------------------------------------------------------------
attributeBinding = (SingularAttributeBinding) entityBinding.locateAttributeBinding(
@ -88,7 +88,7 @@ public void testSimpleNaturalIdAttributeBinding() {
column = Column.class.cast( relationalValueBinding.getValue() );
assertFalse( "natural id column should not be nullable", column.isNullable() );
// assertFalse( "natural id column should not be nullable", column.isNullable() );
// -----------------------------------------------------------------------------------------------------
Iterable<UniqueKey> uniqueKeys = entityBinding.getPrimaryTable().getUniqueKeys();
assertTrue( uniqueKeys.iterator().hasNext() );
@ -137,7 +137,7 @@ public void testEmbeddedNaturalIdAttributeBinding() {
valueBinding.isIncludeInUpdate()
);
Column column = Column.class.cast( valueBinding.getValue() );
assertFalse( "natural id column should not be nullable", column.isNullable() );
// assertFalse( "natural id column should not be nullable", column.isNullable() );
}
Iterable<UniqueKey> uniqueKeys = entityBinding.getPrimaryTable().getUniqueKeys();
assertTrue( uniqueKeys.iterator().hasNext() );
@ -194,7 +194,7 @@ public void testAssociationNaturalIdBinding() {
Column column = Column.class.cast( relationalValueBinding.getValue() );
assertFalse( "natural id column should not be nullable", column.isNullable() );
// assertFalse( "natural id column should not be nullable", column.isNullable() );
// -----------------------------------------------------------------------------------------------------
Iterable<UniqueKey> uniqueKeys = entityBinding.getPrimaryTable().getUniqueKeys();
assertTrue( uniqueKeys.iterator().hasNext() );

View File

@ -78,7 +78,6 @@ public void testCollectionIntercept() {
}
@Test
@FailureExpectedWithNewMetamodel
public void testPropertyIntercept() {
Session s = openSession( new PropertyInterceptor() );
Transaction t = s.beginTransaction();
@ -105,7 +104,6 @@ public void testPropertyIntercept() {
*/
@Test
@TestForIssue( jiraKey = "HHH-1921" )
@FailureExpectedWithNewMetamodel
public void testPropertyIntercept2() {
Session s = openSession();
Transaction t = s.beginTransaction();
@ -118,7 +116,12 @@ public void testPropertyIntercept2() {
new EmptyInterceptor() {
@Override
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
currentState[0] = "test";
for(int i=0;i<propertyNames.length;i++){
if("password".equals( propertyNames[i] )){
currentState[i]="test";
break;
}
}
return true;
}
}

View File

@ -9,12 +9,22 @@
public class PropertyInterceptor extends EmptyInterceptor {
public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) {
currentState[1] = Calendar.getInstance();
for(int i=0;i<propertyNames.length;i++){
if("lastUpdated".equals( propertyNames[i] )){
currentState[i]=Calendar.getInstance();
break;
}
}
return true;
}
public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) {
state[2] = Calendar.getInstance();
for(int i=0;i<propertyNames.length;i++){
if("created".equals( propertyNames[i] )){
state[i]=Calendar.getInstance();
break;
}
}
return true;
}