Author: hardy.ferentschik
Date: 2009-11-13 13:15:10 -0500 (Fri, 13 Nov 2009)
New Revision: 17977
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/TvMagazinPk.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/tuplizer/DynamicComponentTuplizer.java
core/trunk/core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java
core/trunk/core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java
Log:
HHH-4573
ComponentTupilzer - typo in doc
CompositeIdTest, TvMagazinPk - test cleanup
DynamicComponentTupilzer - import cleanup
Ejb3* - Added toString() implementations and changed logging string
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java 2009-11-13
18:12:53 UTC (rev 17976)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3Column.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -184,7 +184,7 @@
initMappingColumn(
logicalColumnName, propertyName, length, precision, scale, nullable, sqlType,
unique, true
);
- log.debug( "Binding column {}. Unique {}. Nullable {}.", new Object[]
{mappingColumn.getName(), unique, nullable});
+ log.debug( "Binding column: " + toString());
}
}
@@ -534,4 +534,17 @@
);
}
}
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append( "Ejb3Column" );
+ sb.append( "{table=" ).append( getTable() );
+ sb.append( ", mappingColumn=" ).append( mappingColumn.getName() );
+ sb.append( ", insertable=" ).append( insertable );
+ sb.append( ", updatable=" ).append( updatable );
+ sb.append( ", unique=" ).append( unique );
+ sb.append( '}' );
+ return sb.toString();
+ }
}
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java
===================================================================
---
core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java 2009-11-13
18:12:53 UTC (rev 17976)
+++
core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -101,4 +101,14 @@
discriminatorColumn.bind();
return discriminatorColumn;
}
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append( "Ejb3DiscriminatorColumn" );
+ sb.append( "{logicalColumnName'" ).append( getLogicalColumnName()
).append( '\'' );
+ sb.append( ", discriminatorTypeName='" ).append( discriminatorTypeName
).append( '\'' );
+ sb.append( '}' );
+ return sb.toString();
+ }
}
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java 2009-11-13
18:12:53 UTC (rev 17976)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -638,4 +638,15 @@
this.mappedByTableName = logicalTableName;
this.mappedByPropertyName = mappedByProperty;
}
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append( "Ejb3JoinColumn" );
+ sb.append( "{logicalColumnName='" ).append( getLogicalColumnName()
).append( '\'' );
+ sb.append( ", referencedColumn='" ).append( referencedColumn ).append(
'\'' );
+ sb.append( ", mappedBy='" ).append( mappedBy ).append( '\''
);
+ sb.append( '}' );
+ return sb.toString();
+ }
}
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java 2009-11-13
18:12:53 UTC (rev 17976)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/CompositeIdTest.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -141,16 +141,13 @@
TvMagazin mag = new TvMagazin();
mag.time = new Date();
mag.id = pk;
- //pk.name = "Trax";
pk.channel = channel;
pk.presenter = pres;
s.persist( mag );
tx.commit();
s.clear();
tx = s.beginTransaction();
- mag = (TvMagazin) s.createQuery( "from TvMagazin mag" ) // where mag.id.name
= :name")
- //.setParameter( "name", "Trax" )
- .uniqueResult();
+ mag = (TvMagazin) s.createQuery( "from TvMagazin mag" ).uniqueResult();
assertNotNull( mag.id );
assertNotNull( mag.id.channel );
assertEquals( channel.id, mag.id.channel.id );
@@ -171,7 +168,6 @@
Product product = new Product();
product.name = "small car";
s.persist( product );
- OrderLinePk pk = new OrderLinePk();
OrderLine orderLine = new OrderLine();
orderLine.order = order;
orderLine.product = product;
@@ -202,16 +198,13 @@
program.time = new Date();
program.id = pk;
program.text = "Award Winning Programming";
- //pk.name = "Trax";
pk.channel = channel;
pk.presenter = pres;
s.persist( program );
tx.commit();
s.clear();
tx = s.beginTransaction();
- program = (TvProgram) s.createQuery( "from TvProgram pr" ) // where
mag.id.name = :name")
- //.setParameter( "name", "Trax" )
- .uniqueResult();
+ program = (TvProgram) s.createQuery( "from TvProgram pr" ).uniqueResult();
assertNotNull( program.id );
assertNotNull( program.id.channel );
assertEquals( channel.id, program.id.channel.id );
@@ -238,14 +231,11 @@
program.channel = channel;
program.presenter = pres;
program.text = "Jump the shark programming";
- //pk.name = "Trax";
s.persist( program );
tx.commit();
s.clear();
tx = s.beginTransaction();
- program = (TvProgramIdClass) s.createQuery( "from TvProgramIdClass pr" ) //
where mag.id.name = :name")
- //.setParameter( "name", "Trax" )
- .uniqueResult();
+ program = (TvProgramIdClass) s.createQuery( "from TvProgramIdClass pr"
).uniqueResult();
assertNotNull( program.channel );
assertEquals( channel.id, program.channel.id );
assertNotNull( program.presenter );
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/TvMagazinPk.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/TvMagazinPk.java 2009-11-13
18:12:53 UTC (rev 17976)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/cid/TvMagazinPk.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -12,7 +12,7 @@
public class TvMagazinPk implements Serializable {
@ManyToOne
public Channel channel;
- //public String name;
+
@ManyToOne
public Presenter presenter;
}
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/tuplizer/DynamicComponentTuplizer.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/tuplizer/DynamicComponentTuplizer.java 2009-11-13
18:12:53 UTC (rev 17976)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/tuplizer/DynamicComponentTuplizer.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -1,16 +1,9 @@
//$Id$
package org.hibernate.test.annotations.tuplizer;
-import org.hibernate.tuple.entity.PojoEntityTuplizer;
-import org.hibernate.tuple.entity.EntityMetamodel;
+import org.hibernate.mapping.Component;
import org.hibernate.tuple.Instantiator;
import org.hibernate.tuple.component.PojoComponentTuplizer;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Component;
-import org.hibernate.proxy.ProxyFactory;
-import org.hibernate.property.Getter;
-import org.hibernate.property.Setter;
-import org.hibernate.HibernateException;
/**
* @author Emmanuel Bernard
@@ -21,9 +14,7 @@
super( component );
}
-
protected Instantiator buildInstantiator(Component component) {
return new DynamicInstantiator( component.getComponentClassName() ); //To change body
of overridden methods use File | Settings | File Templates.
}
-
}
Modified:
core/trunk/core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java 2009-11-13
18:12:53 UTC (rev 17976)
+++
core/trunk/core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -31,7 +31,7 @@
import org.hibernate.tuple.Tuplizer;
/**
- * Defines further responsibilities reagarding tuplization based on
+ * Defines further responsibilities regarding tuplization based on
* a mapped components.
* </p>
* ComponentTuplizer implementations should have the following constructor signature:
Modified:
core/trunk/core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java
===================================================================
---
core/trunk/core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java 2009-11-13
18:12:53 UTC (rev 17976)
+++
core/trunk/core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java 2009-11-13
18:15:10 UTC (rev 17977)
@@ -99,24 +99,23 @@
public Object[] getPropertyValues(Object component) throws HibernateException {
if ( component == BackrefPropertyAccessor.UNKNOWN ) {
- return new Object[ propertySpan ];
+ return new Object[propertySpan];
}
if ( optimizer != null && optimizer.getAccessOptimizer() != null ) {
return optimizer.getAccessOptimizer().getPropertyValues( component );
}
else {
- return super.getPropertyValues(component);
+ return super.getPropertyValues( component );
}
}
public void setPropertyValues(Object component, Object[] values) throws
HibernateException {
if ( optimizer != null && optimizer.getAccessOptimizer() != null ) {
- optimizer.getAccessOptimizer().setPropertyValues( component, values );
+ optimizer.getAccessOptimizer().setPropertyValues( component, values );
}
else {
- super.setPropertyValues(component, values);
+ super.setPropertyValues( component, values );
}
-
}
public Object getParent(Object component) {
@@ -124,19 +123,21 @@
}
public boolean hasParentProperty() {
- return parentGetter!=null;
+ return parentGetter != null;
}
public boolean isMethodOf(Method method) {
- for ( int i=0; i<propertySpan; i++ ) {
+ for ( int i = 0; i < propertySpan; i++ ) {
final Method getterMethod = getters[i].getMethod();
- if ( getterMethod!=null && getterMethod.equals(method) ) return true;
+ if ( getterMethod != null && getterMethod.equals( method ) ) {
+ return true;
+ }
}
return false;
}
public void setParent(Object component, Object parent, SessionFactoryImplementor
factory) {
- parentSetter.set(component, parent, factory);
+ parentSetter.set( component, parent, factory );
}
protected Instantiator buildInstantiator(Component component) {