Hibernate SVN: r11050 - branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-01-16 18:22:50 -0500 (Tue, 16 Jan 2007)
New Revision: 11050
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java
Log:
better exception handling
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java 2007-01-16 18:09:35 UTC (rev 11049)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java 2007-01-16 23:22:50 UTC (rev 11050)
@@ -511,8 +511,8 @@
}
while (logical == null && currentTable != null && description != null);
if (logical == null) {
- throw new MappingException( "Unable to find logical column name from physical name: "
- + table.getName() + "." + physicalName );
+ throw new MappingException( "Unable to find logical column name from physical name "
+ + physicalName + " in table " + table.getName() );
}
return logical;
}
17 years, 8 months
Hibernate SVN: r11049 - branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-01-16 13:09:35 -0500 (Tue, 16 Jan 2007)
New Revision: 11049
Modified:
branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/lucene.xml
Log:
ANN-534
Modified: branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/lucene.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/lucene.xml 2007-01-16 17:33:08 UTC (rev 11048)
+++ branches/Branch_3_2/HibernateExt/metadata/doc/reference/en/modules/lucene.xml 2007-01-16 18:09:35 UTC (rev 11049)
@@ -49,7 +49,7 @@
<section id="lucene-configuration">
<title>Configuration</title>
- <section id="lucene-configuration-directory">
+ <section id="lucene-configuration-directory" revision="1">
<title>Directory configuration</title>
<para>Apache Lucene has a notion of Directory where the index is stored.
@@ -112,7 +112,7 @@
<constant>hibernate.search.<replaceable>indexname</replaceable>.directory_provider</constant></para>
<programlisting>hibernate.search.default.directory_provider org.hibernate.search.store.FSDirectoryProvider
-hibernate.search.default.indexDir=/usr/lucene/indexes
+hibernate.search.default.indexBase=/usr/lucene/indexes
hibernate.search.Rules.directory_provider org.hibernate.search.store.RAMDirectoryProvider
</programlisting>
@@ -160,7 +160,7 @@
</section>
</section>
- <section id="lucene-mapping" revision="1">
+ <section id="lucene-mapping" revision="2">
<title>Mapping entities to the index structure</title>
<para>All the metadata information related to indexed entities is
@@ -182,7 +182,7 @@
<para>The <literal>index</literal> attribute tells Hibernate what the
Lucene directory name is (usually a directory on your file system). If you
wish to define a base directory for all Lucene indexes, you can use the
- <literal>hibernate.search.default.indexDir</literal> property in your
+ <literal>hibernate.search.default.indexBase</literal> property in your
configuration file. Each entity instance will be represented by a Lucene
<classname>Document</classname> inside the given index (aka
Directory).</para>
17 years, 8 months
Hibernate SVN: r11048 - in branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb: packaging and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-01-16 12:33:08 -0500 (Tue, 16 Jan 2007)
New Revision: 11048
Modified:
branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
Log:
Allow customizable transactionType
Modified: branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2007-01-16 15:26:09 UTC (rev 11047)
+++ branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2007-01-16 17:33:08 UTC (rev 11048)
@@ -212,8 +212,8 @@
List<PersistenceMetadata> metadataFiles = PersistenceXmlLoader.deploy(
url,
integration,
- cfg.getEntityResolver()
- );
+ cfg.getEntityResolver(),
+ PersistenceUnitTransactionType.RESOURCE_LOCAL );
for ( PersistenceMetadata metadata : metadataFiles ) {
log.trace( metadata.toString() );
Modified: branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
===================================================================
--- branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2007-01-16 15:26:09 UTC (rev 11047)
+++ branches/Branch_3_2/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2007-01-16 17:33:08 UTC (rev 11048)
@@ -74,8 +74,8 @@
return doc;
}
- public static List<PersistenceMetadata> deploy(URL url, Map overrides, EntityResolver resolver) throws Exception {
-
+ public static List<PersistenceMetadata> deploy(URL url, Map overrides, EntityResolver resolver,
+ PersistenceUnitTransactionType defaultTransactionType) throws Exception {
Document doc = loadURL( url, resolver );
Element top = doc.getDocumentElement();
NodeList children = top.getChildNodes();
@@ -125,7 +125,7 @@
transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL;
}
else {
- transactionType = PersistenceUnitTransactionType.RESOURCE_LOCAL;
+ transactionType = defaultTransactionType;
}
}
metadata.setTransactionType( transactionType );
@@ -135,7 +135,6 @@
}
}
}
-
return units;
}
17 years, 8 months
Hibernate SVN: r11047 - trunk/Hibernate3/src/org/hibernate/type.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-01-16 10:26:09 -0500 (Tue, 16 Jan 2007)
New Revision: 11047
Modified:
trunk/Hibernate3/src/org/hibernate/type/NullableType.java
Log:
HHH-2356 : NullableType.toString + nulls;
javadocs;
formatting
Modified: trunk/Hibernate3/src/org/hibernate/type/NullableType.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/type/NullableType.java 2007-01-16 15:25:54 UTC (rev 11046)
+++ trunk/Hibernate3/src/org/hibernate/type/NullableType.java 2007-01-16 15:26:09 UTC (rev 11047)
@@ -20,32 +20,80 @@
/**
* Superclass of single-column nullable types.
+ *
* @author Gavin King
*/
public abstract class NullableType extends AbstractType {
- private static final boolean IS_TRACE_ENABLED;
- static {
- //cache this, because it was a significant performance cost; is
- // trace logging enabled on the type package...
- IS_TRACE_ENABLED = LogFactory.getLog( StringHelper.qualifier( Type.class.getName() ) ).isTraceEnabled();
+ /**
+ * This is the old scheme where logging of parameter bindings and value extractions
+ * was controlled by the trace level enablement on the 'org.hibernate.type' package...
+ * <p/>
+ * Originally was cached such because of performance of looking up the logger each time
+ * in order to check the trace-enablement. Driving this via a central Log-specific class
+ * would alleviate that performance hit, and yet still allow more "normal" logging usage/config.
+ */
+ private static final boolean IS_VALUE_TRACING_ENABLED = LogFactory.getLog( StringHelper.qualifier( Type.class.getName() ) ).isTraceEnabled();
+ private transient Log log;
+
+ private Log log() {
+ if ( log == null ) {
+ log = LogFactory.getLog( getClass() );
+ }
+ return log;
}
/**
* Get a column value from a result set, without worrying about the
- * possibility of null values
+ * possibility of null values. Called from {@link #nullSafeGet} after
+ * nullness checks have been performed.
+ *
+ * @param rs The result set from which to extract the value.
+ * @param name The name of the value to extract.
+ *
+ * @return The extracted value.
+ *
+ * @throws org.hibernate.HibernateException Generally some form of mismatch error.
+ * @throws java.sql.SQLException Indicates problem making the JDBC call(s).
*/
- public abstract Object get(ResultSet rs, String name)
- throws HibernateException, SQLException;
+ public abstract Object get(ResultSet rs, String name) throws HibernateException, SQLException;
/**
- * Get a parameter value without worrying about the possibility of null values
+ * Set a parameter value without worrying about the possibility of null
+ * values. Called from {@link #nullSafeSet} after nullness checks have
+ * been performed.
+ *
+ * @param st The statement into which to bind the parameter value.
+ * @param value The parameter value to bind.
+ * @param index The position or index at which to bind the param value.
+ *
+ * @throws org.hibernate.HibernateException Generally some form of mismatch error.
+ * @throws java.sql.SQLException Indicates problem making the JDBC call(s).
*/
- public abstract void set(PreparedStatement st, Object value, int index)
- throws HibernateException, SQLException;
+ public abstract void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException;
+ /**
+ * A convenience form of {@link #sqlTypes(org.hibernate.engine.Mapping)}, returning
+ * just a single type value since these are explicitly dealing with single column
+ * mappings.
+ *
+ * @return The {@link java.sql.Types} mapping value.
+ */
public abstract int sqlType();
+ /**
+ * A null-safe version of {@link #toString(Object)}. Specifically we are
+ * worried about null safeness in regards to the incoming value parameter,
+ * not the return.
+ *
+ * @param value The value to convert to a string representation; may be null.
+ * @return The string representation; may be null.
+ * @throws HibernateException Thrown by {@link #toString(Object)}, which this calls.
+ */
+ public String nullSafeToString(Object value) throws HibernateException {
+ return value == null ? null : toString( value );
+ }
+
public abstract String toString(Object value) throws HibernateException;
public abstract Object fromStringValue(String xml) throws HibernateException;
@@ -69,14 +117,14 @@
throws HibernateException, SQLException {
try {
if ( value == null ) {
- if ( IS_TRACE_ENABLED ) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "binding null to parameter: " + index );
}
st.setNull( index, sqlType() );
}
else {
- if ( IS_TRACE_ENABLED ) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "binding '" + toString( value ) + "' to parameter: " + index );
}
@@ -84,11 +132,11 @@
}
}
catch ( RuntimeException re ) {
- log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + re.getMessage() );
+ log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + re.getMessage() );
throw re;
}
catch ( SQLException se ) {
- log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + se.getMessage() );
+ log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + se.getMessage() );
throw se;
}
}
@@ -112,13 +160,13 @@
try {
Object value = get(rs, name);
if ( value == null || rs.wasNull() ) {
- if ( IS_TRACE_ENABLED ) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "returning null as column: " + name );
}
return null;
}
else {
- if (IS_TRACE_ENABLED) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "returning '" + toString( value ) + "' as column: " + name );
}
return value;
@@ -165,7 +213,7 @@
}
public String toLoggableString(Object value, SessionFactoryImplementor factory) {
- return value==null ? "null" : toString(value);
+ return value == null ? "null" : toString(value);
}
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException {
@@ -185,8 +233,4 @@
throws HibernateException {
return checkable[0] && isDirty(old, current, session);
}
-
- private Log log() {
- return LogFactory.getLog( getClass() );
- }
}
17 years, 8 months
Hibernate SVN: r11046 - branches/Branch_3_2/Hibernate3/src/org/hibernate/type.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-01-16 10:25:54 -0500 (Tue, 16 Jan 2007)
New Revision: 11046
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/type/NullableType.java
Log:
HHH-2356 : NullableType.toString + nulls;
javadocs;
formatting
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/type/NullableType.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/type/NullableType.java 2007-01-16 03:27:38 UTC (rev 11045)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/type/NullableType.java 2007-01-16 15:25:54 UTC (rev 11046)
@@ -24,28 +24,75 @@
*/
public abstract class NullableType extends AbstractType {
- private static final boolean IS_TRACE_ENABLED;
- static {
- //cache this, because it was a significant performance cost; is
- // trace logging enabled on the type package...
- IS_TRACE_ENABLED = LogFactory.getLog( StringHelper.qualifier( Type.class.getName() ) ).isTraceEnabled();
+ /**
+ * This is the old scheme where logging of parameter bindings and value extractions
+ * was controlled by the trace level enablement on the 'org.hibernate.type' package...
+ * <p/>
+ * Originally was cached such because of performance of looking up the logger each time
+ * in order to check the trace-enablement. Driving this via a central Log-specific class
+ * would alleviate that performance hit, and yet still allow more "normal" logging usage/config..
+ */
+ private static final boolean IS_VALUE_TRACING_ENABLED = LogFactory.getLog( StringHelper.qualifier( Type.class.getName() ) ).isTraceEnabled();
+ private transient Log log;
+
+ private Log log() {
+ if ( log == null ) {
+ log = LogFactory.getLog( getClass() );
+ }
+ return log;
}
/**
* Get a column value from a result set, without worrying about the
- * possibility of null values
+ * possibility of null values. Called from {@link #nullSafeGet} after
+ * nullness checks have been performed.
+ *
+ * @param rs The result set from which to extract the value.
+ * @param name The name of the value to extract.
+ *
+ * @return The extracted value.
+ *
+ * @throws org.hibernate.HibernateException Generally some form of mismatch error.
+ * @throws java.sql.SQLException Indicates problem making the JDBC call(s).
*/
- public abstract Object get(ResultSet rs, String name)
- throws HibernateException, SQLException;
+ public abstract Object get(ResultSet rs, String name) throws HibernateException, SQLException;
/**
- * Get a parameter value without worrying about the possibility of null values
+ * Set a parameter value without worrying about the possibility of null
+ * values. Called from {@link #nullSafeSet} after nullness checks have
+ * been performed.
+ *
+ * @param st The statement into which to bind the parameter value.
+ * @param value The parameter value to bind.
+ * @param index The position or index at which to bind the param value.
+ *
+ * @throws org.hibernate.HibernateException Generally some form of mismatch error.
+ * @throws java.sql.SQLException Indicates problem making the JDBC call(s).
*/
- public abstract void set(PreparedStatement st, Object value, int index)
- throws HibernateException, SQLException;
+ public abstract void set(PreparedStatement st, Object value, int index) throws HibernateException, SQLException;
+ /**
+ * A convenience form of {@link #sqlTypes(org.hibernate.engine.Mapping)}, returning
+ * just a single type value since these are explicitly dealing with single column
+ * mappings.
+ *
+ * @return The {@link java.sql.Types} mapping value.
+ */
public abstract int sqlType();
+ /**
+ * A null-safe version of {@link #toString(Object)}. Specifically we are
+ * worried about null safeness in regards to the incoming value parameter,
+ * not the return.
+ *
+ * @param value The value to convert to a string representation; may be null.
+ * @return The string representation; may be null.
+ * @throws HibernateException Thrown by {@link #toString(Object)}, which this calls.
+ */
+ public String nullSafeToString(Object value) throws HibernateException {
+ return value == null ? null : toString( value );
+ }
+
public abstract String toString(Object value) throws HibernateException;
public abstract Object fromStringValue(String xml) throws HibernateException;
@@ -55,28 +102,34 @@
Object value,
int index,
boolean[] settable,
- SessionImplementor session)
- throws HibernateException, SQLException {
- if ( settable[0] ) nullSafeSet(st, value, index);
+ SessionImplementor session) throws HibernateException, SQLException {
+ if ( settable[0] ) {
+ nullSafeSet(st, value, index);
+ }
}
- public final void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
- throws HibernateException, SQLException {
+ public final void nullSafeSet(
+ PreparedStatement st,
+ Object value,
+ int index,
+ SessionImplementor session) throws HibernateException, SQLException {
nullSafeSet(st, value, index);
}
- public final void nullSafeSet(PreparedStatement st, Object value, int index)
- throws HibernateException, SQLException {
+ public final void nullSafeSet(
+ PreparedStatement st,
+ Object value,
+ int index) throws HibernateException, SQLException {
try {
if ( value == null ) {
- if ( IS_TRACE_ENABLED ) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "binding null to parameter: " + index );
}
st.setNull( index, sqlType() );
}
else {
- if ( IS_TRACE_ENABLED ) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "binding '" + toString( value ) + "' to parameter: " + index );
}
@@ -84,11 +137,11 @@
}
}
catch ( RuntimeException re ) {
- log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + re.getMessage() );
+ log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + re.getMessage() );
throw re;
}
catch ( SQLException se ) {
- log().info( "could not bind value '" + toString( value ) + "' to parameter: " + index + "; " + se.getMessage() );
+ log().info( "could not bind value '" + nullSafeToString( value ) + "' to parameter: " + index + "; " + se.getMessage() );
throw se;
}
}
@@ -97,28 +150,25 @@
ResultSet rs,
String[] names,
SessionImplementor session,
- Object owner)
- throws HibernateException, SQLException {
+ Object owner) throws HibernateException, SQLException {
return nullSafeGet(rs, names[0]);
}
- public final Object nullSafeGet(ResultSet rs, String[] names)
- throws HibernateException, SQLException {
+ public final Object nullSafeGet(ResultSet rs, String[] names) throws HibernateException, SQLException {
return nullSafeGet(rs, names[0]);
}
- public final Object nullSafeGet(ResultSet rs, String name)
- throws HibernateException, SQLException {
+ public final Object nullSafeGet(ResultSet rs, String name) throws HibernateException, SQLException {
try {
Object value = get(rs, name);
if ( value == null || rs.wasNull() ) {
- if ( IS_TRACE_ENABLED ) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "returning null as column: " + name );
}
return null;
}
else {
- if (IS_TRACE_ENABLED) {
+ if ( IS_VALUE_TRACING_ENABLED ) {
log().trace( "returning '" + toString( value ) + "' as column: " + name );
}
return value;
@@ -186,7 +236,4 @@
return checkable[0] && isDirty(old, current, session);
}
- private Log log() {
- return LogFactory.getLog( getClass() );
- }
}
17 years, 8 months
Hibernate SVN: r11045 - branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-01-15 22:27:38 -0500 (Mon, 15 Jan 2007)
New Revision: 11045
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java
Log:
ANN-532
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java 2007-01-16 03:25:47 UTC (rev 11044)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/cfg/Mappings.java 2007-01-16 03:27:38 UTC (rev 11045)
@@ -490,7 +490,8 @@
}
while (finalName == null && currentTable != null);
if (finalName == null) {
- throw new MappingException( "Unable to find column with logical name: " + table.getName() + "." + logicalName);
+ throw new MappingException( "Unable to find column with logical name "
+ + logicalName + " in table " + table.getName() );
}
return finalName;
}
17 years, 8 months
Hibernate SVN: r11044 - branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-01-15 22:25:47 -0500 (Mon, 15 Jan 2007)
New Revision: 11044
Modified:
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
Log:
ANN-532 better exception handling of @UniqueConstraint
Modified: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2007-01-16 03:22:16 UTC (rev 11043)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2007-01-16 03:25:47 UTC (rev 11044)
@@ -483,11 +483,19 @@
int size = columnNames.length;
Column[] columns = new Column[size];
Set<Column> unbound = new HashSet<Column>();
+ Set<Column> unboundNoLogical = new HashSet<Column>();
ExtendedMappings mappings = createExtendedMappings();
for ( int index = 0; index < size ; index++ ) {
- columns[index] = new Column( mappings.getPhysicalColumnName( columnNames[index], table ) );
- unbound.add( columns[index] );
- //column equals and hashcode is based on column name
+ String columnName;
+ try {
+ columnName = mappings.getPhysicalColumnName( columnNames[index], table );
+ columns[index] = new Column( columnName );
+ unbound.add( columns[index] );
+ //column equals and hashcode is based on column name
+ }
+ catch( MappingException e ) {
+ unboundNoLogical.add( new Column( columnNames[index] ) );
+ }
}
for ( Column column : columns ) {
if ( table.containsColumn( column ) ) {
@@ -496,7 +504,7 @@
unbound.remove( column );
}
}
- if ( unbound.size() > 0 ) {
+ if ( unbound.size() > 0 || unboundNoLogical.size() > 0 ) {
StringBuilder sb = new StringBuilder( "Unable to create unique key constraint (" );
for ( String columnName : columnNames ) {
sb.append( columnName ).append( ", " );
@@ -506,6 +514,9 @@
for ( Column column : unbound ) {
sb.append( column.getName() ).append( ", " );
}
+ for ( Column column : unboundNoLogical ) {
+ sb.append( column.getName() ).append( ", " );
+ }
sb.setLength( sb.length() - 2 );
sb.append( " not found" );
throw new AnnotationException( sb.toString() );
17 years, 8 months
Hibernate SVN: r11043 - branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2007-01-15 22:22:16 -0500 (Mon, 15 Jan 2007)
New Revision: 11043
Modified:
branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java
Log:
oups
Modified: branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java
===================================================================
--- branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2007-01-15 20:50:19 UTC (rev 11042)
+++ branches/Branch_3_2/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2007-01-16 03:22:16 UTC (rev 11043)
@@ -283,6 +283,7 @@
StringBuilder fromAndWhereSb = new StringBuilder( " from " )
.append( associatedClass.getTable().getName() )
//.append(" as ") //Oracle doesn't support it in subqueries
+ .append(" ")
.append(alias).append(" where ");
Iterator collectionTableColumns = element.getColumnIterator();
while ( collectionTableColumns.hasNext() ) {
17 years, 8 months
Hibernate SVN: r11042 - trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging.
by hibernate-commits@lists.jboss.org
Author: bill.burke(a)jboss.com
Date: 2007-01-15 15:50:19 -0500 (Mon, 15 Jan 2007)
New Revision: 11042
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
Log:
allow for passing in of default TransactionType
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2007-01-15 15:41:01 UTC (rev 11041)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2007-01-15 20:50:19 UTC (rev 11042)
@@ -68,8 +68,12 @@
return doc;
}
- public static List<PersistenceMetadata> deploy(URL url, Map overrides, EntityResolver resolver) throws Exception {
+ public static List<PersistenceMetadata> deploy(URL url, Map overrides, EntityResolver resolver) throws Exception {
+ return deploy(url, overrides, resolver, PersistenceUnitTransactionType.RESOURCE_LOCAL);
+ }
+
+ public static List<PersistenceMetadata> deploy(URL url, Map overrides, EntityResolver resolver, PersistenceUnitTransactionType defaultTransactionType) throws Exception {
Document doc = loadURL( url, resolver );
Element top = doc.getDocumentElement();
NodeList children = top.getChildNodes();
@@ -79,7 +83,7 @@
Element element = (Element) children.item( i );
String tag = element.getTagName();
if ( tag.equals( "persistence-unit" ) ) {
- PersistenceMetadata metadata = parsePersistenceUnit( element );
+ PersistenceMetadata metadata = parsePersistenceUnit( element, defaultTransactionType);
//override properties of metadata if needed
String provider = (String) overrides.get( HibernatePersistence.PROVIDER );
if ( provider != null ) {
@@ -107,7 +111,7 @@
return units;
}
- private static PersistenceMetadata parsePersistenceUnit(Element top)
+ private static PersistenceMetadata parsePersistenceUnit(Element top, PersistenceUnitTransactionType defaultTransactionType)
throws Exception {
PersistenceMetadata metadata = new PersistenceMetadata();
String puName = top.getAttribute( "name" );
@@ -117,7 +121,7 @@
}
PersistenceUnitTransactionType transactionType = getTransactionType( top.getAttribute( "transaction-type" ) );
//parsing a persistence.xml means we are in a JavaSE environment
- transactionType = transactionType != null ? transactionType : PersistenceUnitTransactionType.RESOURCE_LOCAL;
+ transactionType = transactionType != null ? transactionType : defaultTransactionType;
metadata.setTransactionType( transactionType );
NodeList children = top.getChildNodes();
for ( int i = 0; i < children.getLength() ; i++ ) {
17 years, 8 months
Hibernate SVN: r11041 - trunk/Hibernate3/test/org/hibernate/test/joinfetch.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-01-15 10:41:01 -0500 (Mon, 15 Jan 2007)
New Revision: 11041
Modified:
trunk/Hibernate3/test/org/hibernate/test/joinfetch/UserGroup.hbm.xml
Log:
workaround issue with Ingres (userName is a function)
Modified: trunk/Hibernate3/test/org/hibernate/test/joinfetch/UserGroup.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/joinfetch/UserGroup.hbm.xml 2007-01-15 15:40:44 UTC (rev 11040)
+++ trunk/Hibernate3/test/org/hibernate/test/joinfetch/UserGroup.hbm.xml 2007-01-15 15:41:01 UTC (rev 11041)
@@ -14,26 +14,19 @@
<class name="User" table="AuctionUsers">
<id name="name"/>
- <map name="groups" table="AuctionUsersGroups"
- fetch="join" order-by="groupName">
- <key column="userName"/>
- <map-key formula="groupName"
- type="string"/>
- <many-to-many column="groupName"
- class="Group"/>
+ <map name="groups" table="AuctionUsersGroups" fetch="join" order-by="groupName">
+ <key column="`userName`"/>
+ <map-key formula="groupName" type="string"/>
+ <many-to-many column="groupName" class="Group"/>
</map>
</class>
<class name="Group" table="AuctionGroups">
<id name="name"/>
- <map name="users" table="AuctionUsersGroups"
- fetch="join" order-by="userName"
- inverse="true" cascade="all">
+ <map name="users" table="AuctionUsersGroups" fetch="join" order-by="`userName`" inverse="true" cascade="all">
<key column="groupName"/>
- <map-key formula="userName"
- type="string"/>
- <many-to-many column="userName"
- class="User"/>
+ <map-key formula="`userName`" type="string"/>
+ <many-to-many column="`userName`" class="User"/>
</map>
</class>
17 years, 8 months