Hibernate SVN: r20140 - core/trunk/core/src/main/java/org/hibernate/hql/ast.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-13 12:46:02 -0400 (Fri, 13 Aug 2010)
New Revision: 20140
Modified:
core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java
Log:
HHH-5449 - Versioned HQL update might issue incorrect SQL
Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java 2010-08-13 16:45:39 UTC (rev 20139)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java 2010-08-13 16:46:02 UTC (rev 20140)
@@ -26,6 +26,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -1116,7 +1117,7 @@
eq.setFirstChild( versionPropertyNode );
AST versionIncrementNode = null;
- if ( Date.class.isAssignableFrom( versionType.getReturnedClass() ) ) {
+ if ( isTimestampBasedVersion( versionType ) ) {
versionIncrementNode = getASTFactory().create( HqlSqlTokenTypes.PARAM, "?" );
ParameterSpecification paramSpec = new VersionTypeSeedParameterSpecification( versionType );
( ( ParameterNode ) versionIncrementNode ).setHqlParameterSpecification( paramSpec );
@@ -1141,6 +1142,12 @@
}
}
+ private boolean isTimestampBasedVersion(VersionType versionType) {
+ final Class javaType = versionType.getReturnedClass();
+ return Date.class.isAssignableFrom( javaType )
+ || Calendar.class.isAssignableFrom( javaType );
+ }
+
private AST generateVersionPropertyNode(Queryable persister) throws SemanticException {
String versionPropertyName = persister.getPropertyNames()[ persister.getVersionProperty() ];
AST versionPropertyRef = getASTFactory().create( HqlSqlTokenTypes.IDENT, versionPropertyName );
13 years, 9 months
Hibernate SVN: r20139 - core/branches/Branch_3_5/core/src/main/java/org/hibernate/hql/ast.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-13 12:45:39 -0400 (Fri, 13 Aug 2010)
New Revision: 20139
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java
Log:
HHH-5449 - Versioned HQL update might issue incorrect SQL
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java 2010-08-13 16:32:46 UTC (rev 20138)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java 2010-08-13 16:45:39 UTC (rev 20139)
@@ -26,6 +26,7 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -1116,7 +1117,7 @@
eq.setFirstChild( versionPropertyNode );
AST versionIncrementNode = null;
- if ( Date.class.isAssignableFrom( versionType.getReturnedClass() ) ) {
+ if ( isTimestampBasedVersion( versionType ) ) {
versionIncrementNode = getASTFactory().create( HqlSqlTokenTypes.PARAM, "?" );
ParameterSpecification paramSpec = new VersionTypeSeedParameterSpecification( versionType );
( ( ParameterNode ) versionIncrementNode ).setHqlParameterSpecification( paramSpec );
@@ -1141,6 +1142,12 @@
}
}
+ private boolean isTimestampBasedVersion(VersionType versionType) {
+ final Class javaType = versionType.getReturnedClass();
+ return Date.class.isAssignableFrom( javaType )
+ || Calendar.class.isAssignableFrom( javaType );
+ }
+
private AST generateVersionPropertyNode(Queryable persister) throws SemanticException {
String versionPropertyName = persister.getPropertyNames()[ persister.getVersionProperty() ];
AST versionPropertyRef = getASTFactory().create( HqlSqlTokenTypes.IDENT, versionPropertyName );
13 years, 9 months
Hibernate SVN: r20138 - in core/trunk/core/src/main/java/org/hibernate: type and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-13 12:32:46 -0400 (Fri, 13 Aug 2010)
New Revision: 20138
Added:
core/trunk/core/src/main/java/org/hibernate/type/StandardBasicTypes.java
Modified:
core/trunk/core/src/main/java/org/hibernate/Hibernate.java
core/trunk/core/src/main/java/org/hibernate/type/BinaryType.java
core/trunk/core/src/main/java/org/hibernate/type/SerializableType.java
Log:
HHH-5477 - Introduce StandardBasicTypes for standard basic type constants
Modified: core/trunk/core/src/main/java/org/hibernate/Hibernate.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/Hibernate.java 2010-08-13 13:15:52 UTC (rev 20137)
+++ core/trunk/core/src/main/java/org/hibernate/Hibernate.java 2010-08-13 16:32:46 UTC (rev 20138)
@@ -106,172 +106,173 @@
private Hibernate() {
throw new UnsupportedOperationException();
}
-
/**
- * Hibernate <tt>long</tt> type.
- * @deprecated Use {@link LongType#INSTANCE} instead.
+ * Hibernate <tt>boolean</tt> type.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#BOOLEAN} instead.
*/
- public static final LongType LONG = LongType.INSTANCE;
+ public static final BooleanType BOOLEAN = BooleanType.INSTANCE;
/**
+ * Hibernate <tt>true_false</tt> type.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#TRUE_FALSE} instead.
+ */
+ public static final TrueFalseType TRUE_FALSE = TrueFalseType.INSTANCE;
+ /**
+ * Hibernate <tt>yes_no</tt> type.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#YES_NO} instead.
+ */
+ public static final YesNoType YES_NO = YesNoType.INSTANCE;
+ /**
+ * Hibernate <tt>byte</tt> type.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#BYTE} instead.
+ */
+ public static final ByteType BYTE = ByteType.INSTANCE;
+ /**
* Hibernate <tt>short</tt> type.
- * @deprecated Use {@link ShortType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#SHORT} instead.
*/
public static final ShortType SHORT = ShortType.INSTANCE;
/**
* Hibernate <tt>integer</tt> type.
- * @deprecated Use {@link IntegerType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#INTEGER} instead.
*/
public static final IntegerType INTEGER = IntegerType.INSTANCE;
/**
- * Hibernate <tt>byte</tt> type.
- * @deprecated Use {@link ByteType#INSTANCE} instead.
+ * Hibernate <tt>long</tt> type.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#LONG} instead.
*/
- public static final ByteType BYTE = ByteType.INSTANCE;
+ public static final LongType LONG = LongType.INSTANCE;
/**
* Hibernate <tt>float</tt> type.
- * @deprecated Use {@link FloatType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#FLOAT} instead.
*/
public static final FloatType FLOAT = FloatType.INSTANCE;
/**
* Hibernate <tt>double</tt> type.
- * @deprecated Use {@link DoubleType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#DOUBLE} instead.
*/
public static final DoubleType DOUBLE = DoubleType.INSTANCE;
/**
+ * Hibernate <tt>big_integer</tt> type.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#BIG_INTEGER} instead.
+ */
+ public static final BigIntegerType BIG_INTEGER = BigIntegerType.INSTANCE;
+ /**
+ * Hibernate <tt>big_decimal</tt> type.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#BIG_DECIMAL} instead.
+ */
+ public static final BigDecimalType BIG_DECIMAL = BigDecimalType.INSTANCE;
+ /**
* Hibernate <tt>character</tt> type.
- * @deprecated Use {@link CharacterType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CHARACTER} instead.
*/
public static final CharacterType CHARACTER = CharacterType.INSTANCE;
/**
* Hibernate <tt>string</tt> type.
- * @deprecated Use {@link StringType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#STRING} instead.
*/
public static final StringType STRING = StringType.INSTANCE;
/**
* Hibernate <tt>time</tt> type.
- * @deprecated Use {@link TimeType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#TIME} instead.
*/
public static final TimeType TIME = TimeType.INSTANCE;
/**
* Hibernate <tt>date</tt> type.
- * @deprecated Use {@link DateType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#DATE} instead.
*/
public static final DateType DATE = DateType.INSTANCE;
/**
* Hibernate <tt>timestamp</tt> type.
- * @deprecated Use {@link TimestampType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#TIMESTAMP} instead.
*/
public static final TimestampType TIMESTAMP = TimestampType.INSTANCE;
/**
- * Hibernate <tt>boolean</tt> type.
- * @deprecated Use {@link BooleanType#INSTANCE} instead.
- */
- public static final BooleanType BOOLEAN = BooleanType.INSTANCE;
- /**
- * Hibernate <tt>true_false</tt> type.
- * @deprecated Use {@link TrueFalseType#INSTANCE} instead.
- */
- public static final TrueFalseType TRUE_FALSE = TrueFalseType.INSTANCE;
- /**
- * Hibernate <tt>yes_no</tt> type.
- * @deprecated Use {@link YesNoType#INSTANCE} instead.
- */
- public static final YesNoType YES_NO = YesNoType.INSTANCE;
- /**
- * Hibernate <tt>big_decimal</tt> type.
- * @deprecated Use {@link BigDecimalType#INSTANCE} instead.
- */
- public static final BigDecimalType BIG_DECIMAL = BigDecimalType.INSTANCE;
- /**
- * Hibernate <tt>big_integer</tt> type.
- * @deprecated Use {@link BigIntegerType#INSTANCE} instead.
- */
- public static final BigIntegerType BIG_INTEGER = BigIntegerType.INSTANCE;
- /**
* Hibernate <tt>binary</tt> type.
- * @deprecated Use {@link BinaryType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#BINARY} instead.
*/
public static final BinaryType BINARY = BinaryType.INSTANCE;
/**
* Hibernate <tt>wrapper-binary</tt> type.
- * @deprecated Use {@link WrapperBinaryType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#WRAPPER_BINARY} instead.
*/
public static final WrapperBinaryType WRAPPER_BINARY = WrapperBinaryType.INSTANCE;
/**
* Hibernate char[] type.
- * @deprecated Use {@link CharArrayType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CHAR_ARRAY} instead.
*/
public static final CharArrayType CHAR_ARRAY = CharArrayType.INSTANCE;
/**
* Hibernate Character[] type.
- * @deprecated Use {@link CharacterArrayType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CHARACTER_ARRAY} instead.
*/
public static final CharacterArrayType CHARACTER_ARRAY = CharacterArrayType.INSTANCE;
/**
* Hibernate <tt>image</tt> type.
- * @deprecated Use {@link ImageType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#IMAGE} instead.
*/
public static final ImageType IMAGE = ImageType.INSTANCE;
/**
* Hibernate <tt>text</tt> type.
- * @deprecated Use {@link TextType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#TEXT} instead.
*/
public static final TextType TEXT = TextType.INSTANCE;
/**
* Hibernate <tt>materialized_blob</tt> type.
- * @deprecated Use {@link MaterializedBlobType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#MATERIALIZED_BLOB} instead.
*/
public static final MaterializedBlobType MATERIALIZED_BLOB = MaterializedBlobType.INSTANCE;
/**
* Hibernate <tt>materialized_clob</tt> type.
- * @deprecated Use {@link MaterializedClobType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#MATERIALIZED_CLOB} instead.
*/
public static final MaterializedClobType MATERIALIZED_CLOB = MaterializedClobType.INSTANCE;
/**
* Hibernate <tt>blob</tt> type.
- * @deprecated Use {@link BlobType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#BLOB} instead.
*/
public static final BlobType BLOB = BlobType.INSTANCE;
/**
* Hibernate <tt>clob</tt> type.
- * @deprecated Use {@link ClobType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CLOB} instead.
*/
public static final ClobType CLOB = ClobType.INSTANCE;
/**
* Hibernate <tt>calendar</tt> type.
- * @deprecated Use {@link CalendarType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CALENDAR} instead.
*/
public static final CalendarType CALENDAR = CalendarType.INSTANCE;
/**
* Hibernate <tt>calendar_date</tt> type.
- * @deprecated Use {@link CalendarDateType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CALENDAR_DATE} instead.
*/
public static final CalendarDateType CALENDAR_DATE = CalendarDateType.INSTANCE;
/**
* Hibernate <tt>locale</tt> type.
- * @deprecated Use {@link LocaleType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#LOCALE} instead.
*/
public static final LocaleType LOCALE = LocaleType.INSTANCE;
/**
* Hibernate <tt>currency</tt> type.
- * @deprecated Use {@link CurrencyType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CURRENCY} instead.
*/
public static final CurrencyType CURRENCY = CurrencyType.INSTANCE;
/**
* Hibernate <tt>timezone</tt> type.
- * @deprecated Use {@link TimeZoneType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#TIMEZONE} instead.
*/
public static final TimeZoneType TIMEZONE = TimeZoneType.INSTANCE;
/**
* Hibernate <tt>class</tt> type.
- * @deprecated Use {@link ClassType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#CLASS} instead.
*/
public static final ClassType CLASS = ClassType.INSTANCE;
/**
* Hibernate <tt>serializable</tt> type.
- * @deprecated Use {@link SerializableType#INSTANCE} instead.
+ * @deprecated Use {@link org.hibernate.type.StandardBasicTypes#SERIALIZABLE} instead.
*/
public static final SerializableType SERIALIZABLE = SerializableType.INSTANCE;
+
+
/**
* Hibernate <tt>object</tt> type.
* @deprecated Use {@link ObjectType#INSTANCE} instead.
Modified: core/trunk/core/src/main/java/org/hibernate/type/BinaryType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/BinaryType.java 2010-08-13 13:15:52 UTC (rev 20137)
+++ core/trunk/core/src/main/java/org/hibernate/type/BinaryType.java 2010-08-13 16:32:46 UTC (rev 20138)
@@ -30,7 +30,7 @@
import org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor;
/**
- * A type that maps between a {@link java.sql.Types#NUMERIC NUMERIC} and {@code byte[]}
+ * A type that maps between a {@link java.sql.Types#VARBINARY VARBINARY} and {@code byte[]}
*
* @author Gavin King
* @author Steve Ebersole
Modified: core/trunk/core/src/main/java/org/hibernate/type/SerializableType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SerializableType.java 2010-08-13 13:15:52 UTC (rev 20137)
+++ core/trunk/core/src/main/java/org/hibernate/type/SerializableType.java 2010-08-13 16:32:46 UTC (rev 20138)
@@ -30,6 +30,14 @@
/**
* A type that maps between a {@link java.sql.Types#VARBINARY VARBINARY} and {@link Serializable} classes.
+ * <p/>
+ * Notice specifically the 2 forms:<ul>
+ * <li>{@link #INSTANCE} indicates a mapping using the {@link Serializable} interface itself.</li>
+ * <li>{@link #SerializableType(Class)} indicates a mapping using the specific class</li>
+ * </ul>
+ * The important distinction has to do with locating the appropriate {@link ClassLoader} to use during deserialization.
+ * In the fist form we are always using the {@link ClassLoader} of the JVM (Hibernate will always fallback to trying
+ * its classloader as well). The second form is better at targeting the needed {@link ClassLoader} actually needed.
*
* @author Gavin King
* @author Steve Ebersole
Added: core/trunk/core/src/main/java/org/hibernate/type/StandardBasicTypes.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/StandardBasicTypes.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/type/StandardBasicTypes.java 2010-08-13 16:32:46 UTC (rev 20138)
@@ -0,0 +1,313 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.type;
+
+/**
+ * Centralizes access to the standard set of basic {@link Type types}.
+ * <p/>
+ * Type mappings can be adjusted per {@link org.hibernate.SessionFactory}. These adjusted mappings can be accessed
+ * from the {@link org.hibernate.TypeHelper} instance obtained via {@link org.hibernate.SessionFactory#getTypeHelper()}
+ *
+ * @see BasicTypeRegistry
+ * @see org.hibernate.TypeHelper
+ * @see org.hibernate.SessionFactory#getTypeHelper()
+ *
+ * @author Gavin King
+ * @author Steve Ebersole
+ */
+public class StandardBasicTypes {
+ /**
+ * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#BIT BIT}.
+ *
+ * @see BooleanType
+ */
+ public static final BooleanType BOOLEAN = BooleanType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#INTEGER INTEGER}.
+ *
+ * @see NumericBooleanType
+ */
+ public static final NumericBooleanType NUMERIC_BOOLEAN = NumericBooleanType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#CHAR CHAR(1)} (using 'T'/'F').
+ *
+ * @see TrueFalseType
+ */
+ public static final TrueFalseType TRUE_FALSE = TrueFalseType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#CHAR CHAR(1)} (using 'Y'/'N').
+ *
+ * @see YesNoType
+ */
+ public static final YesNoType YES_NO = YesNoType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Byte} to JDBC {@link java.sql.Types#TINYINT TINYINT}.
+ */
+ public static final ByteType BYTE = ByteType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Short} to JDBC {@link java.sql.Types#SMALLINT SMALLINT}.
+ *
+ * @see ShortType
+ */
+ public static final ShortType SHORT = ShortType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Integer} to JDBC {@link java.sql.Types#INTEGER INTEGER}.
+ *
+ * @see IntegerType
+ */
+ public static final IntegerType INTEGER = IntegerType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Long} to JDBC {@link java.sql.Types#BIGINT BIGINT}.
+ *
+ * @see LongType
+ */
+ public static final LongType LONG = LongType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Float} to JDBC {@link java.sql.Types#FLOAT FLOAT}.
+ *
+ * @see FloatType
+ */
+ public static final FloatType FLOAT = FloatType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Double} to JDBC {@link java.sql.Types#DOUBLE DOUBLE}.
+ *
+ * @see DoubleType
+ */
+ public static final DoubleType DOUBLE = DoubleType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.math.BigInteger} to JDBC {@link java.sql.Types#NUMERIC NUMERIC}.
+ *
+ * @see BigIntegerType
+ */
+ public static final BigIntegerType BIG_INTEGER = BigIntegerType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.math.BigDecimal} to JDBC {@link java.sql.Types#NUMERIC NUMERIC}.
+ *
+ * @see BigDecimalType
+ */
+ public static final BigDecimalType BIG_DECIMAL = BigDecimalType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Character} to JDBC {@link java.sql.Types#CHAR CHAR(1)}.
+ *
+ * @see CharacterType
+ */
+ public static final CharacterType CHARACTER = CharacterType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see StringType
+ */
+ public static final StringType STRING = StringType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.net.URL} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see UrlType
+ */
+ public static final UrlType URL = UrlType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.Date} ({@link java.sql.Time}) to JDBC
+ * {@link java.sql.Types#TIME TIME}.
+ *
+ * @see TimeType
+ */
+ public static final TimeType TIME = TimeType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.Date} ({@link java.sql.Date}) to JDBC
+ * {@link java.sql.Types#DATE DATE}.
+ *
+ * @see TimeType
+ */
+ public static final DateType DATE = DateType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.Date} ({@link java.sql.Timestamp}) to JDBC
+ * {@link java.sql.Types#TIMESTAMP TIMESTAMP}.
+ *
+ * @see TimeType
+ */
+ public static final TimestampType TIMESTAMP = TimestampType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.Calendar} to JDBC
+ * {@link java.sql.Types#TIMESTAMP TIMESTAMP}.
+ *
+ * @see CalendarType
+ */
+ public static final CalendarType CALENDAR = CalendarType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.Calendar} to JDBC
+ * {@link java.sql.Types#DATE DATE}.
+ *
+ * @see CalendarDateType
+ */
+ public static final CalendarDateType CALENDAR_DATE = CalendarDateType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Class} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see ClassType
+ */
+ public static final ClassType CLASS = ClassType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.Locale} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see LocaleType
+ */
+ public static final LocaleType LOCALE = LocaleType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.Currency} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see CurrencyType
+ */
+ public static final CurrencyType CURRENCY = CurrencyType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.TimeZone} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see TimeZoneType
+ */
+ public static final TimeZoneType TIMEZONE = TimeZoneType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.UUID} to JDBC {@link java.sql.Types#BINARY BINARY}.
+ *
+ * @see UUIDBinaryType
+ */
+ public static final UUIDBinaryType UUID_BINARY = UUIDBinaryType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.util.UUID} to JDBC {@link java.sql.Types#CHAR CHAR}.
+ *
+ * @see UUIDCharType
+ */
+ public static final UUIDCharType UUID_CHAR = UUIDCharType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link java.sql.Types#VARBINARY VARBINARY}.
+ *
+ * @see BinaryType
+ */
+ public static final BinaryType BINARY = BinaryType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Byte Byte[]} to JDBC {@link java.sql.Types#VARBINARY VARBINARY}.
+ *
+ * @see WrapperBinaryType
+ */
+ public static final WrapperBinaryType WRAPPER_BINARY = WrapperBinaryType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link java.sql.Types#LONGVARBINARY LONGVARBINARY}.
+ *
+ * @see ImageType
+ * @see #MATERIALIZED_BLOB
+ */
+ public static final ImageType IMAGE = ImageType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.sql.Blob} to JDBC {@link java.sql.Types#BLOB BLOB}.
+ *
+ * @see BlobType
+ * @see #MATERIALIZED_BLOB
+ */
+ public static final BlobType BLOB = BlobType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link java.sql.Types#BLOB BLOB}.
+ *
+ * @see MaterializedBlobType
+ * @see #MATERIALIZED_BLOB
+ * @see #IMAGE
+ */
+ public static final MaterializedBlobType MATERIALIZED_BLOB = MaterializedBlobType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@code char[]} to JDBC {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see CharArrayType
+ */
+ public static final CharArrayType CHAR_ARRAY = CharArrayType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link Character Character[]} to JDBC
+ * {@link java.sql.Types#VARCHAR VARCHAR}.
+ *
+ * @see CharacterArrayType
+ */
+ public static final CharacterArrayType CHARACTER_ARRAY = CharacterArrayType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#LONGVARCHAR LONGVARCHAR}.
+ * <p/>
+ * Similar to a {@link #MATERIALIZED_CLOB}
+ *
+ * @see TextType
+ */
+ public static final TextType TEXT = TextType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.sql.Clob} to JDBC {@link java.sql.Types#CLOB CLOB}.
+ *
+ * @see ClobType
+ * @see #MATERIALIZED_CLOB
+ */
+ public static final ClobType CLOB = ClobType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link String} to JDBC {@link java.sql.Types#CLOB CLOB}.
+ *
+ * @see MaterializedClobType
+ * @see #MATERIALIZED_CLOB
+ * @see #TEXT
+ */
+ public static final MaterializedClobType MATERIALIZED_CLOB = MaterializedClobType.INSTANCE;
+
+ /**
+ * The standard Hibernate type for mapping {@link java.io.Serializable} to JDBC {@link java.sql.Types#VARBINARY VARBINARY}.
+ * <p/>
+ * See especially the discussion wrt {@link ClassLoader} determination on {@link SerializableType}
+ *
+ * @see SerializableType
+ */
+ public static final SerializableType SERIALIZABLE = SerializableType.INSTANCE;
+}
13 years, 9 months
Hibernate SVN: r20137 - core/trunk/documentation/quickstart/src/main/docbook/en-US.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-13 09:15:52 -0400 (Fri, 13 Aug 2010)
New Revision: 20137
Modified:
core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml
Log:
HHH-5441 - Create "Getting Started Guide"
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml 2010-08-12 19:13:48 UTC (rev 20136)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml 2010-08-13 13:15:52 UTC (rev 20137)
@@ -4,7 +4,7 @@
%BOOK_ENTITIES;
]>
-<bookinfo id="Hibernate_Getting_Started_Guide">
+<bookinfo id="Hibernate_Getting_Started_Guide" xmlns="http://www.oasis-open.org/docbook/xml/4.5/">
<title>Hibernate Getting Started Guide</title>
<releaseinfo>&version;</releaseinfo>
<edition>1.0</edition>
@@ -25,7 +25,5 @@
<year>©rightYear;</year>
<holder>©rightHolder;</holder>
</copyright>
-
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-
</bookinfo>
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml 2010-08-12 19:13:48 UTC (rev 20136)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml 2010-08-13 13:15:52 UTC (rev 20137)
@@ -4,7 +4,7 @@
%BOOK_ENTITIES;
]>
-<book>
+<book xmlns="http://www.oasis-open.org/docbook/xml/4.5/">
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Book_Info.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/preface.xml" />
@@ -13,6 +13,4 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_native.xml" />
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_annotations.xml" />
-
-
</book>
\ No newline at end of file
13 years, 9 months
Hibernate SVN: r20136 - in core/trunk/core/src/main/java/org/hibernate/cfg: annotations and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-12 15:13:48 -0400 (Thu, 12 Aug 2010)
New Revision: 20136
Modified:
core/trunk/core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java
core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java
core/trunk/core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java
core/trunk/core/src/main/java/org/hibernate/cfg/CollectionPropertyHolder.java
core/trunk/core/src/main/java/org/hibernate/cfg/ColumnsBuilder.java
core/trunk/core/src/main/java/org/hibernate/cfg/ComponentPropertyHolder.java
core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java
core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3Column.java
core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java
core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java
core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java
core/trunk/core/src/main/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java
core/trunk/core/src/main/java/org/hibernate/cfg/InheritanceState.java
core/trunk/core/src/main/java/org/hibernate/cfg/JoinedSubclassFkSecondPass.java
core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java
core/trunk/core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java
core/trunk/core/src/main/java/org/hibernate/cfg/ToOneBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java
core/trunk/core/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java
core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java
Log:
HHH-5474 - Clean up usages of now deprecated ExtendedMappings
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/AbstractPropertyHolder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -54,13 +54,15 @@
private Map<String, JoinTable> holderJoinTableOverride;
private Map<String, JoinTable> currentPropertyJoinTableOverride;
private String path;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private Boolean isInIdClass;
public AbstractPropertyHolder(
- String path, PropertyHolder parent, XClass clazzToProcess, ExtendedMappings mappings
- ) {
+ String path,
+ PropertyHolder parent,
+ XClass clazzToProcess,
+ Mappings mappings) {
this.path = path;
this.parent = (AbstractPropertyHolder) parent;
this.mappings = mappings;
@@ -80,7 +82,7 @@
return path;
}
- protected ExtendedMappings getMappings() {
+ protected Mappings getMappings() {
return mappings;
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/AnnotationBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -21,9 +21,6 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
-
-// $Id$
-
package org.hibernate.cfg;
import java.lang.annotation.Annotation;
@@ -203,7 +200,7 @@
private static final Logger log = LoggerFactory.getLogger( AnnotationBinder.class );
- public static void bindDefaults(ExtendedMappings mappings) {
+ public static void bindDefaults(Mappings mappings) {
Map defaults = mappings.getReflectionManager().getDefaults();
{
List<SequenceGenerator> anns = ( List<SequenceGenerator> ) defaults.get( SequenceGenerator.class );
@@ -253,7 +250,7 @@
}
}
- public static void bindPackage(String packageName, ExtendedMappings mappings) {
+ public static void bindPackage(String packageName, Mappings mappings) {
XPackage pckg;
try {
pckg = mappings.getReflectionManager().packageForName( packageName );
@@ -282,7 +279,7 @@
BinderHelper.bindAnyMetaDefs( pckg, mappings );
}
- private static void bindGenericGenerators(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
+ private static void bindGenericGenerators(XAnnotatedElement annotatedElement, Mappings mappings) {
GenericGenerator defAnn = annotatedElement.getAnnotation( GenericGenerator.class );
GenericGenerators defsAnn = annotatedElement.getAnnotation( GenericGenerators.class );
if ( defAnn != null ) {
@@ -295,12 +292,12 @@
}
}
- private static void bindGenericGenerator(GenericGenerator def, ExtendedMappings mappings) {
+ private static void bindGenericGenerator(GenericGenerator def, Mappings mappings) {
IdGenerator idGen = buildIdGenerator( def, mappings );
mappings.addGenerator( idGen );
}
- private static void bindQueries(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
+ private static void bindQueries(XAnnotatedElement annotatedElement, Mappings mappings) {
{
SqlResultSetMapping ann = annotatedElement.getAnnotation( SqlResultSetMapping.class );
QueryBinder.bindSqlResultsetMapping( ann, mappings, false );
@@ -355,7 +352,7 @@
}
}
- private static IdGenerator buildIdGenerator(java.lang.annotation.Annotation ann, ExtendedMappings mappings) {
+ private static IdGenerator buildIdGenerator(java.lang.annotation.Annotation ann, Mappings mappings) {
IdGenerator idGen = new IdGenerator();
if ( mappings.getSchemaName() != null ) {
idGen.addParam( PersistentIdentifierGenerator.SCHEMA, mappings.getSchemaName() );
@@ -470,7 +467,7 @@
if ( seqGen.initialValue() != 1 ) {
log.warn(
"Hibernate does not support SequenceGenerator.initialValue() unless '{}' set",
- AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS
+ Configuration.USE_NEW_ID_GENERATOR_MAPPINGS
);
}
idGen.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( seqGen.allocationSize() - 1 ) );
@@ -503,8 +500,9 @@
* @throws MappingException in case there is an configuration error
*/
public static void bindClass(
- XClass clazzToProcess, Map<XClass, InheritanceState> inheritanceStatePerClass, ExtendedMappings mappings
- ) throws MappingException {
+ XClass clazzToProcess,
+ Map<XClass, InheritanceState> inheritanceStatePerClass,
+ Mappings mappings) throws MappingException {
//@Entity and @MappedSuperclass on the same class leads to a NPE down the road
if ( clazzToProcess.isAnnotationPresent( Entity.class )
&& clazzToProcess.isAnnotationPresent( MappedSuperclass.class ) ) {
@@ -763,7 +761,16 @@
}
- private static void processIdPropertiesIfNotAlready(Map<XClass, InheritanceState> inheritanceStatePerClass, ExtendedMappings mappings, PersistentClass persistentClass, EntityBinder entityBinder, PropertyHolder propertyHolder, HashMap<String, IdGenerator> classGenerators, InheritanceState.ElementsToProcess elementsToProcess, boolean subclassAndSingleTableStrategy, Set<String> idPropertiesIfIdClass) {
+ private static void processIdPropertiesIfNotAlready(
+ Map<XClass, InheritanceState> inheritanceStatePerClass,
+ Mappings mappings,
+ PersistentClass persistentClass,
+ EntityBinder entityBinder,
+ PropertyHolder propertyHolder,
+ HashMap<String, IdGenerator> classGenerators,
+ InheritanceState.ElementsToProcess elementsToProcess,
+ boolean subclassAndSingleTableStrategy,
+ Set<String> idPropertiesIfIdClass) {
Set<String> missingIdProperties = new HashSet<String>( idPropertiesIfIdClass );
for ( PropertyData propertyAnnotatedElement : elementsToProcess.getElements() ) {
String propertyName = propertyAnnotatedElement.getPropertyName();
@@ -795,7 +802,15 @@
}
}
- private static boolean mapAsIdClass(Map<XClass, InheritanceState> inheritanceStatePerClass, InheritanceState inheritanceState, PersistentClass persistentClass, EntityBinder entityBinder, PropertyHolder propertyHolder, InheritanceState.ElementsToProcess elementsToProcess, Set<String> idPropertiesIfIdClass, ExtendedMappings mappings) {
+ private static boolean mapAsIdClass(
+ Map<XClass, InheritanceState> inheritanceStatePerClass,
+ InheritanceState inheritanceState,
+ PersistentClass persistentClass,
+ EntityBinder entityBinder,
+ PropertyHolder propertyHolder,
+ InheritanceState.ElementsToProcess elementsToProcess,
+ Set<String> idPropertiesIfIdClass,
+ Mappings mappings) {
/*
* We are looking for @IdClass
* In general we map the id class as identifier using the mapping metadata of the main entity's properties
@@ -916,7 +931,7 @@
PropertyData baseInferredData,
AccessType propertyAccessor,
Map<XClass, InheritanceState> inheritanceStatePerClass,
- ExtendedMappings mappings) {
+ Mappings mappings) {
if ( elementsToProcess.getIdPropertyCount() == 1 ) {
final PropertyData idPropertyOnBaseClass = getUniqueIdPropertyFromBaseClass(
inferredData, baseInferredData, propertyAccessor, mappings
@@ -946,7 +961,7 @@
}
}
- private static Cache determineCacheSettings(XClass clazzToProcess, ExtendedMappings mappings) {
+ private static Cache determineCacheSettings(XClass clazzToProcess, Mappings mappings) {
Cache cacheAnn = clazzToProcess.getAnnotation( Cache.class );
if ( cacheAnn != null ) {
return cacheAnn;
@@ -979,7 +994,7 @@
return cacheAnn;
}
- private static SharedCacheMode determineSharedCacheMode(ExtendedMappings mappings) {
+ private static SharedCacheMode determineSharedCacheMode(Mappings mappings) {
SharedCacheMode mode;
final Object value = mappings.getConfigurationProperties().get( "javax.persistence.sharedCache.mode" );
if ( value == null ) {
@@ -1006,7 +1021,7 @@
return mode;
}
- private static Cache buildCacheMock(String region, ExtendedMappings mappings) {
+ private static Cache buildCacheMock(String region, Mappings mappings) {
return new LocalCacheAnnotationImpl( region, determineCacheConcurrencyStrategy( mappings ) );
}
@@ -1018,12 +1033,12 @@
return;
}
- if ( !properties.containsKey( AnnotationConfiguration.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
+ if ( !properties.containsKey( Configuration.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
log.trace( "Given properties did not contain any default cache concurrency strategy setting" );
return;
}
- final String strategyName = properties.getProperty( AnnotationConfiguration.DEFAULT_CACHE_CONCURRENCY_STRATEGY );
+ final String strategyName = properties.getProperty( Configuration.DEFAULT_CACHE_CONCURRENCY_STRATEGY );
log.trace( "Discovered default cache concurrency strategy via config [" + strategyName + "]" );
CacheConcurrencyStrategy strategy = CacheConcurrencyStrategy.parse( strategyName );
if ( strategy == null ) {
@@ -1035,7 +1050,7 @@
DEFAULT_CACHE_CONCURRENCY_STRATEGY = strategy;
}
- private static CacheConcurrencyStrategy determineCacheConcurrencyStrategy(ExtendedMappings mappings) {
+ private static CacheConcurrencyStrategy determineCacheConcurrencyStrategy(Mappings mappings) {
if ( DEFAULT_CACHE_CONCURRENCY_STRATEGY == null ) {
final RegionFactory cacheRegionFactory = SettingsFactory.createRegionFactory(
mappings.getConfigurationProperties(), true
@@ -1094,7 +1109,11 @@
return persistentClass;
}
- private static Ejb3JoinColumn[] makeInheritanceJoinColumns(XClass clazzToProcess, ExtendedMappings mappings, InheritanceState inheritanceState, PersistentClass superEntity) {
+ private static Ejb3JoinColumn[] makeInheritanceJoinColumns(
+ XClass clazzToProcess,
+ Mappings mappings,
+ InheritanceState inheritanceState,
+ PersistentClass superEntity) {
Ejb3JoinColumn[] inheritanceJoinedColumns = null;
final boolean hasJoinedColumns = inheritanceState.hasParents()
&& InheritanceType.JOINED.equals( inheritanceState.getType() );
@@ -1133,7 +1152,7 @@
return inheritanceJoinedColumns;
}
- private static PersistentClass getSuperEntity(XClass clazzToProcess, Map<XClass, InheritanceState> inheritanceStatePerClass, ExtendedMappings mappings, InheritanceState inheritanceState) {
+ private static PersistentClass getSuperEntity(XClass clazzToProcess, Map<XClass, InheritanceState> inheritanceStatePerClass, Mappings mappings, InheritanceState inheritanceState) {
InheritanceState superEntityState = InheritanceState.getInheritanceStateOfSuperEntity(
clazzToProcess, inheritanceStatePerClass
);
@@ -1185,7 +1204,7 @@
*/
private static void bindFilters(XClass annotatedClass, EntityBinder entityBinder,
- ExtendedMappings mappings) {
+ Mappings mappings) {
bindFilters( annotatedClass, entityBinder );
@@ -1215,7 +1234,7 @@
}
}
- private static void bindFilterDefs(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
+ private static void bindFilterDefs(XAnnotatedElement annotatedElement, Mappings mappings) {
FilterDef defAnn = annotatedElement.getAnnotation( FilterDef.class );
FilterDefs defsAnn = annotatedElement.getAnnotation( FilterDefs.class );
if ( defAnn != null ) {
@@ -1228,7 +1247,7 @@
}
}
- private static void bindFilterDef(FilterDef defAnn, ExtendedMappings mappings) {
+ private static void bindFilterDef(FilterDef defAnn, Mappings mappings) {
Map<String, org.hibernate.type.Type> params = new HashMap<String, org.hibernate.type.Type>();
for ( ParamDef param : defAnn.parameters() ) {
params.put( param.name(), mappings.getTypeResolver().heuristicType( param.type() ) );
@@ -1238,7 +1257,7 @@
mappings.addFilterDefinition( def );
}
- private static void bindTypeDefs(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
+ private static void bindTypeDefs(XAnnotatedElement annotatedElement, Mappings mappings) {
TypeDef defAnn = annotatedElement.getAnnotation( TypeDef.class );
TypeDefs defsAnn = annotatedElement.getAnnotation( TypeDefs.class );
if ( defAnn != null ) {
@@ -1251,7 +1270,7 @@
}
}
- private static void bindFetchProfiles(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
+ private static void bindFetchProfiles(XAnnotatedElement annotatedElement, Mappings mappings) {
FetchProfile fetchProfileAnnotation = annotatedElement.getAnnotation( FetchProfile.class );
FetchProfiles fetchProfileAnnotations = annotatedElement.getAnnotation( FetchProfiles.class );
if ( fetchProfileAnnotation != null ) {
@@ -1264,7 +1283,7 @@
}
}
- private static void bindFetchProfile(FetchProfile fetchProfileAnnotation, ExtendedMappings mappings) {
+ private static void bindFetchProfile(FetchProfile fetchProfileAnnotation, Mappings mappings) {
for ( FetchProfile.FetchOverride fetch : fetchProfileAnnotation.fetchOverrides() ) {
org.hibernate.annotations.FetchMode mode = fetch.mode();
if ( !mode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) {
@@ -1276,7 +1295,7 @@
}
}
- private static void bindTypeDef(TypeDef defAnn, ExtendedMappings mappings) {
+ private static void bindTypeDef(TypeDef defAnn, Mappings mappings) {
Properties params = new Properties();
for ( Parameter param : defAnn.parameters() ) {
params.setProperty( param.name(), param.value() );
@@ -1306,7 +1325,7 @@
Ejb3DiscriminatorColumn discriminatorColumn,
Map<String, Join> secondaryTables,
PropertyHolder propertyHolder,
- ExtendedMappings mappings) {
+ Mappings mappings) {
if ( rootClass.getDiscriminator() == null ) {
if ( discriminatorColumn == null ) {
throw new AssertionFailure( "discriminator column should have been built" );
@@ -1333,8 +1352,10 @@
* the determined access strategy, {@code false} otherwise.
*/
static int addElementsOfClass(
- List<PropertyData> elements, AccessType defaultAccessType, PropertyContainer propertyContainer, ExtendedMappings mappings
- ) {
+ List<PropertyData> elements,
+ AccessType defaultAccessType,
+ PropertyContainer propertyContainer,
+ Mappings mappings) {
int idPropertyCounter = 0;
AccessType accessType = defaultAccessType;
@@ -1353,9 +1374,11 @@
}
private static int addProperty(
- PropertyContainer propertyContainer, XProperty property, List<PropertyData> annElts,
- String propertyAccessor, ExtendedMappings mappings
- ) {
+ PropertyContainer propertyContainer,
+ XProperty property,
+ List<PropertyData> annElts,
+ String propertyAccessor,
+ Mappings mappings) {
final XClass declaringClass = propertyContainer.getDeclaringClass();
final XClass entity = propertyContainer.getEntityAtStake();
int idPropertyCounter = 0;
@@ -1391,12 +1414,16 @@
*/
private static void processElementAnnotations(
- PropertyHolder propertyHolder, Nullability nullability,
- PropertyData inferredData, HashMap<String, IdGenerator> classGenerators,
- EntityBinder entityBinder, boolean isIdentifierMapper,
- boolean isComponentEmbedded, boolean inSecondPass, ExtendedMappings mappings,
- Map<XClass, InheritanceState> inheritanceStatePerClass
- ) throws MappingException {
+ PropertyHolder propertyHolder,
+ Nullability nullability,
+ PropertyData inferredData,
+ HashMap<String, IdGenerator> classGenerators,
+ EntityBinder entityBinder,
+ boolean isIdentifierMapper,
+ boolean isComponentEmbedded,
+ boolean inSecondPass,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) throws MappingException {
/**
* inSecondPass can only be used to apply right away the second pass of a composite-element
* Because it's a value type, there is no bidirectional association, hence second pass
@@ -2065,7 +2092,7 @@
SimpleValue idValue,
HashMap<String, IdGenerator> classGenerators,
boolean isIdentifierMapper,
- ExtendedMappings mappings) {
+ Mappings mappings) {
if ( isIdentifierMapper ) {
throw new AnnotationException(
"@IdClass class should not have @Id nor @EmbeddedId properties: "
@@ -2103,10 +2130,13 @@
//TODO move that to collection binder?
private static void bindJoinedTableAssociation(
- XProperty property, ExtendedMappings mappings, EntityBinder entityBinder,
- CollectionBinder collectionBinder, PropertyHolder propertyHolder, PropertyData inferredData,
- String mappedBy
- ) {
+ XProperty property,
+ Mappings mappings,
+ EntityBinder entityBinder,
+ CollectionBinder collectionBinder,
+ PropertyHolder propertyHolder,
+ PropertyData inferredData,
+ String mappedBy) {
TableBinder associationTableBinder = new TableBinder();
JoinColumn[] annJoins;
JoinColumn[] annInverseJoins;
@@ -2181,7 +2211,7 @@
AccessType propertyAccessor,
EntityBinder entityBinder,
boolean isIdentifierMapper,
- ExtendedMappings mappings,
+ Mappings mappings,
boolean isComponentEmbedded,
boolean isId, //is a identifier
Map<XClass, InheritanceState> inheritanceStatePerClass,
@@ -2240,13 +2270,16 @@
}
public static Component fillComponent(
- PropertyHolder propertyHolder, PropertyData inferredData,
- AccessType propertyAccessor, boolean isNullable,
+ PropertyHolder propertyHolder,
+ PropertyData inferredData,
+ AccessType propertyAccessor,
+ boolean isNullable,
EntityBinder entityBinder,
- boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass,
- ExtendedMappings mappings, Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
-
+ boolean isComponentEmbedded,
+ boolean isIdentifierMapper,
+ boolean inSecondPass,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
return fillComponent(
propertyHolder, inferredData, null, propertyAccessor,
isNullable, entityBinder, isComponentEmbedded, isIdentifierMapper, inSecondPass, mappings,
@@ -2255,13 +2288,17 @@
}
public static Component fillComponent(
- PropertyHolder propertyHolder, PropertyData inferredData,
+ PropertyHolder propertyHolder,
+ PropertyData inferredData,
PropertyData baseInferredData, //base inferred data correspond to the entity reproducing inferredData's properties (ie IdClass)
- AccessType propertyAccessor, boolean isNullable, EntityBinder entityBinder,
- boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, ExtendedMappings mappings,
- Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
-
+ AccessType propertyAccessor,
+ boolean isNullable,
+ EntityBinder entityBinder,
+ boolean isComponentEmbedded,
+ boolean isIdentifierMapper,
+ boolean inSecondPass,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
/**
* inSecondPass can only be used to apply right away the second pass of a composite-element
* Because it's a value type, there is no bidirectional association, hence second pass
@@ -2380,7 +2417,7 @@
PropertyData inferredData,
boolean isComponentEmbedded,
boolean isIdentifierMapper,
- ExtendedMappings mappings) {
+ Mappings mappings) {
Component comp = new Component( mappings, propertyHolder.getPersistentClass() );
comp.setEmbedded( isComponentEmbedded );
//yuk
@@ -2397,13 +2434,19 @@
}
private static void bindIdClass(
- String generatorType, String generatorName, PropertyData inferredData,
- PropertyData baseInferredData, Ejb3Column[] columns, PropertyHolder propertyHolder,
+ String generatorType,
+ String generatorName,
+ PropertyData inferredData,
+ PropertyData baseInferredData,
+ Ejb3Column[] columns,
+ PropertyHolder propertyHolder,
boolean isComposite,
- AccessType propertyAccessor, EntityBinder entityBinder, boolean isEmbedded,
- boolean isIdentifierMapper, ExtendedMappings mappings,
- Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
+ AccessType propertyAccessor,
+ EntityBinder entityBinder,
+ boolean isEmbedded,
+ boolean isIdentifierMapper,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
/*
* Fill simple value and property since and Id is a property
@@ -2485,7 +2528,7 @@
PropertyData inferredData,
PropertyData baseInferredData,
AccessType propertyAccessor,
- ExtendedMappings mappings) {
+ Mappings mappings) {
List<PropertyData> baseClassElements = new ArrayList<PropertyData>();
XClass baseReturnedClassOrElement = baseInferredData.getClassOrElement();
PropertyContainer propContainer = new PropertyContainer(
@@ -2514,14 +2557,19 @@
}
private static void bindManyToOne(
- String cascadeStrategy, Ejb3JoinColumn[] columns, boolean optional,
- boolean ignoreNotFound, boolean cascadeOnDelete,
- XClass targetEntity, PropertyHolder propertyHolder,
- PropertyData inferredData, boolean unique,
- boolean isIdentifierMapper, boolean inSecondPass,
+ String cascadeStrategy,
+ Ejb3JoinColumn[] columns,
+ boolean optional,
+ boolean ignoreNotFound,
+ boolean cascadeOnDelete,
+ XClass targetEntity,
+ PropertyHolder propertyHolder,
+ PropertyData inferredData,
+ boolean unique,
+ boolean isIdentifierMapper,
+ boolean inSecondPass,
PropertyBinder propertyBinder,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
//All FK columns should be in the same table
org.hibernate.mapping.ManyToOne value = new org.hibernate.mapping.ManyToOne( mappings, columns[0].getTable() );
// This is a @OneToOne mapped to a physical o.h.mapping.ManyToOne
@@ -2655,8 +2703,7 @@
boolean isIdentifierMapper,
boolean inSecondPass,
PropertyBinder propertyBinder,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
//column.getTable() => persistentClass.getTable()
final String propertyName = inferredData.getPropertyName();
log.trace( "Fetching {} with {}", propertyName, fetchMode );
@@ -2721,10 +2768,15 @@
}
private static void bindAny(
- String cascadeStrategy, Ejb3JoinColumn[] columns, boolean cascadeOnDelete, Nullability nullability,
- PropertyHolder propertyHolder, PropertyData inferredData, EntityBinder entityBinder,
- boolean isIdentifierMapper, ExtendedMappings mappings
- ) {
+ String cascadeStrategy,
+ Ejb3JoinColumn[] columns,
+ boolean cascadeOnDelete,
+ Nullability nullability,
+ PropertyHolder propertyHolder,
+ PropertyData inferredData,
+ EntityBinder entityBinder,
+ boolean isIdentifierMapper,
+ Mappings mappings) {
org.hibernate.annotations.Any anyAnn = inferredData.getProperty()
.getAnnotation( org.hibernate.annotations.Any.class );
if ( anyAnn == null ) {
@@ -2759,7 +2811,7 @@
propertyHolder.addProperty( prop, columns, inferredData.getDeclaringClass() );
}
- private static String generatorType(GenerationType generatorEnum, ExtendedMappings mappings) {
+ private static String generatorType(GenerationType generatorEnum, Mappings mappings) {
boolean useNewGeneratorMappings = mappings.useNewGeneratorMappings();
switch ( generatorEnum ) {
case IDENTITY:
@@ -2811,8 +2863,10 @@
}
private static String getCascadeStrategy(
- javax.persistence.CascadeType[] ejbCascades, Cascade hibernateCascadeAnnotation,
- boolean orphanRemoval, boolean forcePersist) {
+ javax.persistence.CascadeType[] ejbCascades,
+ Cascade hibernateCascadeAnnotation,
+ boolean orphanRemoval,
+ boolean forcePersist) {
EnumSet<CascadeType> hibernateCascadeSet = convertToHibernateCascadeType( ejbCascades );
CascadeType[] hibernateCascades = hibernateCascadeAnnotation == null ?
null :
@@ -2883,7 +2937,7 @@
}
}
- private static HashMap<String, IdGenerator> buildLocalGenerators(XAnnotatedElement annElt, ExtendedMappings mappings) {
+ private static HashMap<String, IdGenerator> buildLocalGenerators(XAnnotatedElement annElt, Mappings mappings) {
HashMap<String, IdGenerator> generators = new HashMap<String, IdGenerator>();
TableGenerator tabGen = annElt.getAnnotation( TableGenerator.class );
SequenceGenerator seqGen = annElt.getAnnotation( SequenceGenerator.class );
@@ -2903,7 +2957,7 @@
return generators;
}
- public static boolean isDefault(XClass clazz, ExtendedMappings mappings) {
+ public static boolean isDefault(XClass clazz, Mappings mappings) {
return mappings.getReflectionManager().equals( clazz, void.class );
}
@@ -2917,7 +2971,7 @@
*/
public static Map<XClass, InheritanceState> buildInheritanceStates(
List<XClass> orderedClasses,
- ExtendedMappings mappings) {
+ Mappings mappings) {
ReflectionManager reflectionManager = mappings.getReflectionManager();
Map<XClass, InheritanceState> inheritanceStatePerClass = new HashMap<XClass, InheritanceState>(
orderedClasses.size()
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/BinderHelper.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -118,8 +118,8 @@
PersistentClass ownerEntity,
PersistentClass associatedEntity,
Value value,
- boolean inverse, ExtendedMappings mappings
- ) {
+ boolean inverse,
+ Mappings mappings) {
//associated entity only used for more precise exception, yuk!
if ( columns[0].isImplicit() || StringHelper.isNotEmpty( columns[0].getMappedBy() ) ) return;
int fkEnum = Ejb3JoinColumn.checkReferencedColumnsType( columns, ownerEntity, mappings );
@@ -232,9 +232,9 @@
private static List<Property> findPropertiesByColumns(
- Object columnOwner, Ejb3JoinColumn[] columns,
- ExtendedMappings mappings
- ) {
+ Object columnOwner,
+ Ejb3JoinColumn[] columns,
+ Mappings mappings) {
Map<Column, Set<Property>> columnsToProperty = new HashMap<Column, Set<Property>>();
List<Column> orderedColumns = new ArrayList<Column>( columns.length );
Table referencedTable = null;
@@ -434,8 +434,9 @@
* If columnName is null or empty, persistentClass is returned
*/
public static Object findColumnOwner(
- PersistentClass persistentClass, String columnName, ExtendedMappings mappings
- ) {
+ PersistentClass persistentClass,
+ String columnName,
+ Mappings mappings) {
if ( StringHelper.isEmpty( columnName ) ) {
return persistentClass; //shortcut for implicit referenced column names
}
@@ -474,9 +475,11 @@
* apply an id generator to a SimpleValue
*/
public static void makeIdGenerator(
- SimpleValue id, String generatorType, String generatorName, ExtendedMappings mappings,
- Map<String, IdGenerator> localGenerators
- ) {
+ SimpleValue id,
+ String generatorType,
+ String generatorName,
+ Mappings mappings,
+ Map<String, IdGenerator> localGenerators) {
Table table = id.getTable();
table.setIdentifierValue( id );
//generator settings
@@ -528,9 +531,17 @@
//equivalent to (but faster) ANNOTATION_STRING_DEFAULT.equals( annotationString );
}
- public static Any buildAnyValue(String anyMetaDefName, Ejb3JoinColumn[] columns, javax.persistence.Column metaColumn, PropertyData inferredData,
- boolean cascadeOnDelete, Nullability nullability, PropertyHolder propertyHolder,
- EntityBinder entityBinder, boolean optional, ExtendedMappings mappings) {
+ public static Any buildAnyValue(
+ String anyMetaDefName,
+ Ejb3JoinColumn[] columns,
+ javax.persistence.Column metaColumn,
+ PropertyData inferredData,
+ boolean cascadeOnDelete,
+ Nullability nullability,
+ PropertyHolder propertyHolder,
+ EntityBinder entityBinder,
+ boolean optional,
+ Mappings mappings) {
//All FK columns should be in the same table
Any value = new Any( mappings, columns[0].getTable() );
AnyMetaDef metaAnnDef = inferredData.getProperty().getAnnotation( AnyMetaDef.class );
@@ -577,8 +588,10 @@
}
}
- Ejb3Column[] metaColumns = Ejb3Column.buildColumnFromAnnotation( new javax.persistence.Column[] { metaColumn }, null,
- nullability, propertyHolder, inferredData, entityBinder.getSecondaryTables(), mappings );
+ Ejb3Column[] metaColumns = Ejb3Column.buildColumnFromAnnotation(
+ new javax.persistence.Column[] { metaColumn }, null,
+ nullability, propertyHolder, inferredData, entityBinder.getSecondaryTables(), mappings
+ );
//set metaColumn to the right table
for (Ejb3Column column : metaColumns) {
column.setTable( value.getTable() );
@@ -597,7 +610,7 @@
return value;
}
- public static void bindAnyMetaDefs(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
+ public static void bindAnyMetaDefs(XAnnotatedElement annotatedElement, Mappings mappings) {
AnyMetaDef defAnn = annotatedElement.getAnnotation( AnyMetaDef.class );
AnyMetaDefs defsAnn = annotatedElement.getAnnotation( AnyMetaDefs.class );
boolean mustHaveName = XClass.class.isAssignableFrom( annotatedElement.getClass() )
@@ -623,15 +636,16 @@
}
}
- private static void bindAnyMetaDef(AnyMetaDef defAnn, ExtendedMappings mappings) {
+ private static void bindAnyMetaDef(AnyMetaDef defAnn, Mappings mappings) {
if ( isDefault( defAnn.name() ) ) return; //don't map not named definitions
log.info( "Binding Any Meta definition: {}", defAnn.name() );
mappings.addAnyMetaDef( defAnn );
}
- public static MappedSuperclass getMappedSuperclassOrNull(XClass declaringClass,
- Map<XClass, InheritanceState> inheritanceStatePerClass,
- ExtendedMappings mappings) {
+ public static MappedSuperclass getMappedSuperclassOrNull(
+ XClass declaringClass,
+ Map<XClass, InheritanceState> inheritanceStatePerClass,
+ Mappings mappings) {
boolean retrieve = false;
if ( declaringClass != null ) {
final InheritanceState inheritanceState = inheritanceStatePerClass.get( declaringClass );
@@ -653,7 +667,11 @@
return StringHelper.qualify( holder.getPath(), property.getPropertyName() );
}
- static PropertyData getPropertyOverriddenByMapperOrMapsId(boolean isId, PropertyHolder propertyHolder, String propertyName, ExtendedMappings mappings) {
+ static PropertyData getPropertyOverriddenByMapperOrMapsId(
+ boolean isId,
+ PropertyHolder propertyHolder,
+ String propertyName,
+ Mappings mappings) {
final XClass persistentXClass;
try {
persistentXClass = mappings.getReflectionManager()
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/ClassPropertyHolder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -49,9 +49,11 @@
private final Map<XClass, InheritanceState> inheritanceStatePerClass;
public ClassPropertyHolder(
- PersistentClass persistentClass, XClass clazzToProcess,
- Map<String, Join> joins, ExtendedMappings mappings, Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
+ PersistentClass persistentClass,
+ XClass clazzToProcess,
+ Map<String, Join> joins,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
super( persistentClass.getEntityName(), null, clazzToProcess, mappings );
this.persistentClass = persistentClass;
this.joins = joins;
@@ -59,9 +61,11 @@
}
public ClassPropertyHolder(
- PersistentClass persistentClass, XClass clazzToProcess, EntityBinder entityBinder,
- ExtendedMappings mappings, Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
+ PersistentClass persistentClass,
+ XClass clazzToProcess,
+ EntityBinder entityBinder,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
this( persistentClass, clazzToProcess, entityBinder.getSecondaryTables(), mappings, inheritanceStatePerClass );
this.entityBinder = entityBinder;
}
@@ -127,7 +131,7 @@
}
private void addPropertyToMappedSuperclass(Property prop, XClass declaringClass) {
- final ExtendedMappings mappings = getMappings();
+ final Mappings mappings = getMappings();
final Class type = mappings.getReflectionManager().toClass( declaringClass );
MappedSuperclass superclass = mappings.getMappedSuperclass( type );
superclass.addDeclaredProperty( prop );
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/CollectionPropertyHolder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/CollectionPropertyHolder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/CollectionPropertyHolder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -42,9 +42,12 @@
Collection collection;
public CollectionPropertyHolder(
- Collection collection, String path, XClass clazzToProcess, XProperty property,
- PropertyHolder parentPropertyHolder, ExtendedMappings mappings
- ) {
+ Collection collection,
+ String path,
+ XClass clazzToProcess,
+ XProperty property,
+ PropertyHolder parentPropertyHolder,
+ Mappings mappings) {
super( path, parentPropertyHolder, clazzToProcess, mappings );
this.collection = collection;
setCurrentProperty( property );
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/ColumnsBuilder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/ColumnsBuilder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/ColumnsBuilder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -46,7 +46,7 @@
/**
* Do the initial discovery of columns metadata and apply defaults.
- * Also hosts some convinient methods related to column processing
+ * Also hosts some convenient methods related to column processing
*
* @author Emmanuel Bernard
*/
@@ -56,11 +56,17 @@
private XProperty property;
private PropertyData inferredData;
private EntityBinder entityBinder;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private Ejb3Column[] columns;
private Ejb3JoinColumn[] joinColumns;
- public ColumnsBuilder(PropertyHolder propertyHolder, Nullability nullability, XProperty property, PropertyData inferredData, EntityBinder entityBinder, ExtendedMappings mappings) {
+ public ColumnsBuilder(
+ PropertyHolder propertyHolder,
+ Nullability nullability,
+ XProperty property,
+ PropertyData inferredData,
+ EntityBinder entityBinder,
+ Mappings mappings) {
this.propertyHolder = propertyHolder;
this.nullability = nullability;
this.property = property;
@@ -214,7 +220,9 @@
Ejb3Column[] overrideColumnFromMapperOrMapsIdProperty(boolean isId) {
Ejb3Column[] result = columns;
- final PropertyData overridingProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId( isId, propertyHolder, property.getName(), mappings );
+ final PropertyData overridingProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId(
+ isId, propertyHolder, property.getName(), mappings
+ );
if ( overridingProperty != null ) {
result = buildExcplicitOrDefaultJoinColumn( overridingProperty );
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/ComponentPropertyHolder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/ComponentPropertyHolder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/ComponentPropertyHolder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -84,9 +84,11 @@
}
public ComponentPropertyHolder(
- Component component, String path, PropertyData inferredData, PropertyHolder parent,
- ExtendedMappings mappings
- ) {
+ Component component,
+ String path,
+ PropertyData inferredData,
+ PropertyHolder parent,
+ Mappings mappings) {
super( path, parent, inferredData.getPropertyClass(), mappings );
final XProperty property = inferredData.getProperty();
setCurrentProperty( property );
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -975,7 +975,7 @@
*
* @return The created mappings
*/
- public ExtendedMappings createMappings() {
+ public Mappings createMappings() {
return new MappingsImpl();
}
@@ -4018,7 +4018,7 @@
log.debug( "Process annotated classes" );
//bind classes in the correct order calculating some inheritance state
List<XClass> orderedClasses = orderAndFillHierarchy( annotatedClasses );
- ExtendedMappings mappings = createMappings();
+ Mappings mappings = createMappings();
Map<XClass, InheritanceState> inheritanceStatePerClass = AnnotationBinder.buildInheritanceStates(
orderedClasses, mappings
);
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/CopyIdentifierComponentSecondPass.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -42,28 +42,32 @@
public class CopyIdentifierComponentSecondPass implements SecondPass {
private final String referencedEntityName;
private final Component component;
- private final ExtendedMappings mappings;
+ private final Mappings mappings;
private final Ejb3JoinColumn[] joinColumns;
public CopyIdentifierComponentSecondPass(
- Component comp, String referencedEntityName, Ejb3JoinColumn[] joinColumns, ExtendedMappings mappings) {
+ Component comp,
+ String referencedEntityName,
+ Ejb3JoinColumn[] joinColumns,
+ Mappings mappings) {
this.component = comp;
this.referencedEntityName = referencedEntityName;
this.mappings = mappings;
this.joinColumns = joinColumns;
}
- //FIXME better error names
+ @SuppressWarnings({ "unchecked" })
public void doSecondPass(Map persistentClasses) throws MappingException {
PersistentClass referencedPersistentClass = (PersistentClass) persistentClasses.get( referencedEntityName );
+ // TODO better error names
if ( referencedPersistentClass == null ) {
- throw new AnnotationException(
- "Unknown entity name: " + referencedEntityName
+ throw new AnnotationException( "Unknown entity name: " + referencedEntityName );
+ }
+ if ( ! ( referencedPersistentClass.getIdentifier() instanceof Component ) ) {
+ throw new AssertionFailure(
+ "Unexpected identifier type on the referenced entity when mapping a @MapsId: "
+ + referencedEntityName
);
- };
- if ( ! ( referencedPersistentClass.getIdentifier() instanceof Component ) ) {
- throw new AssertionFailure( "Unexpected identifier type on the referenced entity when mapping a @MapsId: "
- + referencedEntityName);
}
Component referencedComponent = (Component) referencedPersistentClass.getIdentifier();
Iterator<Property> properties = referencedComponent.getPropertyIterator();
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3Column.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3Column.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3Column.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -52,7 +52,7 @@
private String secondaryTableName;
protected Map<String, Join> joins;
protected PropertyHolder propertyHolder;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private boolean isImplicit;
public static final int DEFAULT_COLUMN_LENGTH = 255;
public String sqlType;
@@ -96,7 +96,7 @@
}
public boolean isFormula() {
- return StringHelper.isNotEmpty(formulaString) ? true : false;
+ return StringHelper.isNotEmpty( formulaString );
}
public String getFormulaString() {
@@ -123,11 +123,11 @@
this.updatable = updatable;
}
- protected ExtendedMappings getMappings() {
+ protected Mappings getMappings() {
return mappings;
}
- public void setMappings(ExtendedMappings mappings) {
+ public void setMappings(Mappings mappings) {
this.mappings = mappings;
}
@@ -362,23 +362,25 @@
public static Ejb3Column[] buildColumnFromAnnotation(
javax.persistence.Column[] anns,
- org.hibernate.annotations.Formula formulaAnn, Nullability nullability, PropertyHolder propertyHolder,
+ org.hibernate.annotations.Formula formulaAnn,
+ Nullability nullability,
+ PropertyHolder propertyHolder,
PropertyData inferredData,
Map<String, Join> secondaryTables,
- ExtendedMappings mappings
- ){
+ Mappings mappings){
return buildColumnFromAnnotation(
- anns,
- formulaAnn, nullability, propertyHolder, inferredData, null, secondaryTables, mappings);
+ anns, formulaAnn, nullability, propertyHolder, inferredData, null, secondaryTables, mappings
+ );
}
public static Ejb3Column[] buildColumnFromAnnotation(
javax.persistence.Column[] anns,
- org.hibernate.annotations.Formula formulaAnn, Nullability nullability, PropertyHolder propertyHolder,
+ org.hibernate.annotations.Formula formulaAnn,
+ Nullability nullability,
+ PropertyHolder propertyHolder,
PropertyData inferredData,
String suffixForDefaultColumnName,
Map<String, Join> secondaryTables,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
Ejb3Column[] columns;
if ( formulaAnn != null ) {
Ejb3Column formulaColumn = new Ejb3Column();
@@ -463,7 +465,7 @@
Map<String, Join> secondaryTables,
PropertyHolder propertyHolder,
Nullability nullability,
- ExtendedMappings mappings) {
+ Mappings mappings) {
Ejb3Column column = new Ejb3Column();
Ejb3Column[] columns = new Ejb3Column[1];
columns[0] = column;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3DiscriminatorColumn.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -35,13 +35,11 @@
* @author Emmanuel Bernard
*/
public class Ejb3DiscriminatorColumn extends Ejb3Column {
-
-
private static final String DEFAULT_DISCRIMINATOR_COLUMN_NAME = "DTYPE";
private static final String DEFAULT_DISCRIMINATOR_TYPE = "string";
+ private static final int DEFAULT_DISCRIMINATOR_LENGTH = 31;
private String discriminatorTypeName;
- private static final int DEFAULT_DISCRIMINATOR_LENGTH = 31;
public Ejb3DiscriminatorColumn() {
//discriminator default value
@@ -61,9 +59,9 @@
}
public static Ejb3DiscriminatorColumn buildDiscriminatorColumn(
- DiscriminatorType type, DiscriminatorColumn discAnn, DiscriminatorFormula discFormulaAnn,
- ExtendedMappings mappings
- ) {
+ DiscriminatorType type, DiscriminatorColumn discAnn,
+ DiscriminatorFormula discFormulaAnn,
+ Mappings mappings) {
Ejb3DiscriminatorColumn discriminatorColumn = new Ejb3DiscriminatorColumn();
discriminatorColumn.setMappings( mappings );
discriminatorColumn.setImplicit( true );
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Ejb3JoinColumn.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -69,7 +69,7 @@
this.JPA2ElementCollection = JPA2ElementCollection;
}
- //FIXME hacky solution to get the information at property ref resolution
+ // TODO hacky solution to get the information at property ref resolution
public String getManyToManyOwnerSideEntityName() {
return manyToManyOwnerSideEntityName;
}
@@ -113,8 +113,7 @@
String propertyName,
String mappedBy,
boolean isImplicit,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
super();
setImplicit( isImplicit );
setSqlType( sqlType );
@@ -137,25 +136,27 @@
return referencedColumn;
}
-
public static Ejb3JoinColumn[] buildJoinColumnsOrFormulas(
JoinColumnsOrFormulas anns,
- String mappedBy, Map<String, Join> joins,
+ String mappedBy,
+ Map<String, Join> joins,
PropertyHolder propertyHolder,
String propertyName,
- ExtendedMappings mappings
- ) {
-
+ Mappings mappings) {
JoinColumnOrFormula [] ann = anns.value();
Ejb3JoinColumn [] joinColumns = new Ejb3JoinColumn[ann.length];
for (int i = 0; i < ann.length; i++) {
JoinColumnOrFormula join = (JoinColumnOrFormula) ann[i];
JoinFormula formula = join.formula();
if (formula.value() != null && !formula.value().equals("")) {
- joinColumns[i] = buildJoinFormula(formula, mappedBy, joins, propertyHolder, propertyName, mappings);
+ joinColumns[i] = buildJoinFormula(
+ formula, mappedBy, joins, propertyHolder, propertyName, mappings
+ );
}
else {
- joinColumns[i] = buildJoinColumns(new JoinColumn[] { join.column() }, mappedBy, joins, propertyHolder, propertyName, mappings)[0];
+ joinColumns[i] = buildJoinColumns(
+ new JoinColumn[] { join.column() }, mappedBy, joins, propertyHolder, propertyName, mappings
+ )[0];
}
}
@@ -167,43 +168,42 @@
*/
public static Ejb3JoinColumn buildJoinFormula(
JoinFormula ann,
- String mappedBy, Map<String, Join> joins,
+ String mappedBy,
+ Map<String, Join> joins,
PropertyHolder propertyHolder,
String propertyName,
- ExtendedMappings mappings
- ) {
-
- Ejb3JoinColumn formulaColumn = new Ejb3JoinColumn();
- formulaColumn.setFormula( ann.value() );
- formulaColumn.setReferencedColumn(ann.referencedColumnName());
- formulaColumn.setMappings( mappings );
- formulaColumn.setPropertyHolder( propertyHolder );
- formulaColumn.setJoins( joins );
- formulaColumn.setPropertyName( BinderHelper.getRelativePath( propertyHolder, propertyName ) );
-
- formulaColumn.bind();
- return formulaColumn;
- }
-
-
+ Mappings mappings) {
+ Ejb3JoinColumn formulaColumn = new Ejb3JoinColumn();
+ formulaColumn.setFormula( ann.value() );
+ formulaColumn.setReferencedColumn(ann.referencedColumnName());
+ formulaColumn.setMappings( mappings );
+ formulaColumn.setPropertyHolder( propertyHolder );
+ formulaColumn.setJoins( joins );
+ formulaColumn.setPropertyName( BinderHelper.getRelativePath( propertyHolder, propertyName ) );
+ formulaColumn.bind();
+ return formulaColumn;
+ }
+
public static Ejb3JoinColumn[] buildJoinColumns(
JoinColumn[] anns,
- String mappedBy, Map<String, Join> joins,
+ String mappedBy,
+ Map<String, Join> joins,
PropertyHolder propertyHolder,
String propertyName,
- ExtendedMappings mappings
- ) {
- return buildJoinColumnsWithDefaultColumnSuffix(anns, mappedBy, joins, propertyHolder, propertyName, "", mappings);
+ Mappings mappings) {
+ return buildJoinColumnsWithDefaultColumnSuffix(
+ anns, mappedBy, joins, propertyHolder, propertyName, "", mappings
+ );
}
public static Ejb3JoinColumn[] buildJoinColumnsWithDefaultColumnSuffix(
JoinColumn[] anns,
- String mappedBy, Map<String, Join> joins,
+ String mappedBy,
+ Map<String, Join> joins,
PropertyHolder propertyHolder,
String propertyName,
String suffixForDefaultColumnName,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
JoinColumn[] actualColumns = propertyHolder.getOverriddenJoinColumn(
StringHelper.qualify( propertyHolder.getPath(), propertyName )
);
@@ -247,8 +247,7 @@
PropertyHolder propertyHolder,
String propertyName,
String suffixForDefaultColumnName,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
if ( ann != null ) {
if ( BinderHelper.isDefault( mappedBy ) ) {
throw new AnnotationException(
@@ -293,7 +292,7 @@
}
- //FIXME default name still useful in association table
+ // TODO default name still useful in association table
public void setJoinAnnotation(JoinColumn annJoin, String defaultName) {
if ( annJoin == null ) {
setImplicit( true );
@@ -319,9 +318,8 @@
JoinColumn joinAnn,
Value identifier,
Map<String, Join> joins,
- PropertyHolder propertyHolder, ExtendedMappings mappings
- ) {
-
+ PropertyHolder propertyHolder,
+ Mappings mappings) {
Column col = (Column) identifier.getColumnIterator().next();
String defaultName = mappings.getLogicalColumnName( col.getQuotedName(), identifier.getTable() );
if ( pkJoinAnn != null || joinAnn != null ) {
@@ -369,10 +367,11 @@
* Override persistent class on oneToMany Cases for late settings
* Must only be used on second level pass binding
*/
- public void setPersistentClass(PersistentClass persistentClass,
- Map<String, Join> joins,
- Map<XClass, InheritanceState> inheritanceStatePerClass) {
- //FIXME shouldn't we deduce the classname from the persistentclasS?
+ public void setPersistentClass(
+ PersistentClass persistentClass,
+ Map<String, Join> joins,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
+ // TODO shouldn't we deduce the classname from the persistentclasS?
this.propertyHolder = PropertyHolderBuilder.buildPropertyHolder( persistentClass, joins, getMappings(), inheritanceStatePerClass );
}
@@ -390,8 +389,9 @@
public void copyReferencedStructureAndCreateDefaultJoinColumns(
- PersistentClass referencedEntity, Iterator columnIterator, SimpleValue value
- ) {
+ PersistentClass referencedEntity,
+ Iterator columnIterator,
+ SimpleValue value) {
if ( !isNameDeferred() ) {
throw new AssertionFailure( "Building implicit column but the column is not implicit" );
}
@@ -404,8 +404,9 @@
}
public void linkValueUsingDefaultColumnNaming(
- Column referencedColumn, PersistentClass referencedEntity, SimpleValue value
- ) {
+ Column referencedColumn,
+ PersistentClass referencedEntity,
+ SimpleValue value) {
String columnName;
String logicalReferencedColumn = getMappings().getLogicalColumnName(
referencedColumn.getQuotedName(), referencedEntity.getTable()
@@ -528,9 +529,9 @@
public static final int NON_PK_REFERENCE = 2;
public static int checkReferencedColumnsType(
- Ejb3JoinColumn[] columns, PersistentClass referencedEntity,
- ExtendedMappings mappings
- ) {
+ Ejb3JoinColumn[] columns,
+ PersistentClass referencedEntity,
+ Mappings mappings) {
//convenient container to find whether a column is an id one or not
Set<Column> idColumns = new HashSet<Column>();
Iterator idColumnsIt = referencedEntity.getKey().getColumnIterator();
@@ -605,7 +606,6 @@
* @param column the referenced column.
*/
public void overrideFromReferencedColumnIfNecessary(org.hibernate.mapping.Column column) {
-
if (getMappingColumn() != null) {
// columnDefinition can also be specified using @JoinColumn, hence we have to check
// whether it is set or not
@@ -633,9 +633,12 @@
}
public static Ejb3JoinColumn[] buildJoinTableJoinColumns(
- JoinColumn[] annJoins, Map<String, Join> secondaryTables,
- PropertyHolder propertyHolder, String propertyName, String mappedBy, ExtendedMappings mappings
- ) {
+ JoinColumn[] annJoins,
+ Map<String, Join> secondaryTables,
+ PropertyHolder propertyHolder,
+ String propertyName,
+ String mappedBy,
+ Mappings mappings) {
Ejb3JoinColumn[] joinColumns;
if ( annJoins == null ) {
Ejb3JoinColumn currentJoinColumn = new Ejb3JoinColumn();
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/IndexColumn.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -34,12 +34,10 @@
*
* @author inger
*/
-public class IndexColumn
- extends Ejb3Column {
-
+public class IndexColumn extends Ejb3Column {
private int base;
- //FIXME move to a getter setter strategy for readeability
+ // TODO move to a getter setter strategy for readability
public IndexColumn(
boolean isImplicit,
String sqlType,
@@ -54,8 +52,7 @@
String secondaryTableName,
Map<String, Join> joins,
PropertyHolder propertyHolder,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
super();
setImplicit( isImplicit );
setSqlType( sqlType );
@@ -72,8 +69,6 @@
setJoins( joins );
setMappings( mappings );
bind();
- //super(isImplicit, sqlType, length, precision, scale, name, nullable, unique, insertable, updatable, secondaryTableName, joins, propertyHolder, mappings);
-
}
public int getBase() {
@@ -90,8 +85,7 @@
PropertyHolder propertyHolder,
PropertyData inferredData,
Map<String, Join> secondaryTables,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
IndexColumn column;
if ( ann != null ) {
String sqlType = BinderHelper.isDefault( ann.columnDefinition() ) ? null : ann.columnDefinition();
@@ -123,8 +117,7 @@
org.hibernate.annotations.IndexColumn ann,
PropertyHolder propertyHolder,
PropertyData inferredData,
- ExtendedMappings mappings
- ) {
+ Mappings mappings) {
IndexColumn column;
if ( ann != null ) {
String sqlType = BinderHelper.isDefault( ann.columnDefinition() ) ? null : ann.columnDefinition();
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/IndexOrUniqueKeySecondPass.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -37,14 +37,14 @@
private Table table;
private final String indexName;
private final String[] columns;
- private final ExtendedMappings mappings;
+ private final Mappings mappings;
private final Ejb3Column column;
private final boolean unique;
/**
* Build an index
*/
- public IndexOrUniqueKeySecondPass(Table table, String indexName, String[] columns, ExtendedMappings mappings) {
+ public IndexOrUniqueKeySecondPass(Table table, String indexName, String[] columns, Mappings mappings) {
this.table = table;
this.indexName = indexName;
this.columns = columns;
@@ -56,15 +56,14 @@
/**
* Build an index
*/
- public IndexOrUniqueKeySecondPass(String indexName, Ejb3Column column, ExtendedMappings mappings) {
+ public IndexOrUniqueKeySecondPass(String indexName, Ejb3Column column, Mappings mappings) {
this( indexName, column, mappings, false );
}
/**
* Build an index if unique is false or a Unique Key if unique is true
*/
- public IndexOrUniqueKeySecondPass(String indexName, Ejb3Column column,
- ExtendedMappings mappings, boolean unique) {
+ public IndexOrUniqueKeySecondPass(String indexName, Ejb3Column column, Mappings mappings, boolean unique) {
this.indexName = indexName;
this.column = column;
this.columns = null;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/InheritanceState.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/InheritanceState.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/InheritanceState.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -62,14 +62,12 @@
private boolean isEmbeddableSuperclass = false;
private Map<XClass, InheritanceState> inheritanceStatePerClass;
private List<XClass> classesToProcessForMappedSuperclass = new ArrayList<XClass>();
- private ExtendedMappings mappings;
+ private Mappings mappings;
private AccessType accessType;
private ElementsToProcess elementsToProcess;
private Boolean hasIdClassOrEmbeddedId;
- public InheritanceState(XClass clazz,
- Map<XClass, InheritanceState> inheritanceStatePerClass,
- ExtendedMappings mappings) {
+ public InheritanceState(XClass clazz, Map<XClass, InheritanceState> inheritanceStatePerClass, Mappings mappings) {
this.setClazz( clazz );
this.mappings = mappings;
this.inheritanceStatePerClass = inheritanceStatePerClass;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/JoinedSubclassFkSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/JoinedSubclassFkSecondPass.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/JoinedSubclassFkSecondPass.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -36,9 +36,13 @@
@SuppressWarnings({"serial", "unchecked"})
public class JoinedSubclassFkSecondPass extends FkSecondPass {
private JoinedSubclass entity;
- private ExtendedMappings mappings;
+ private Mappings mappings;
- public JoinedSubclassFkSecondPass(JoinedSubclass entity, Ejb3JoinColumn[] inheritanceJoinedColumns, SimpleValue key, ExtendedMappings mappings) {
+ public JoinedSubclassFkSecondPass(
+ JoinedSubclass entity,
+ Ejb3JoinColumn[] inheritanceJoinedColumns,
+ SimpleValue key,
+ Mappings mappings) {
super( key, inheritanceJoinedColumns );
this.entity = entity;
this.mappings = mappings;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/OneToOneSecondPass.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -48,7 +48,7 @@
*/
public class OneToOneSecondPass implements SecondPass {
private String mappedBy;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private String ownerEntity;
private String ownerProperty;
private PropertyHolder propertyHolder;
@@ -62,11 +62,18 @@
//that suck, we should read that from the property mainly
public OneToOneSecondPass(
- String mappedBy, String ownerEntity, String ownerProperty,
- PropertyHolder propertyHolder, PropertyData inferredData, XClass targetEntity, boolean ignoreNotFound,
- boolean cascadeOnDelete, boolean optional, String cascadeStrategy, Ejb3JoinColumn[] columns,
- ExtendedMappings mappings
- ) {
+ String mappedBy,
+ String ownerEntity,
+ String ownerProperty,
+ PropertyHolder propertyHolder,
+ PropertyData inferredData,
+ XClass targetEntity,
+ boolean ignoreNotFound,
+ boolean cascadeOnDelete,
+ boolean optional,
+ String cascadeStrategy,
+ Ejb3JoinColumn[] columns,
+ Mappings mappings) {
this.ownerEntity = ownerEntity;
this.ownerProperty = ownerProperty;
this.mappedBy = mappedBy;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/PropertyHolderBuilder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -46,11 +46,11 @@
XClass clazzToProcess,
PersistentClass persistentClass,
EntityBinder entityBinder,
- //Map<String, Join> joins,
- ExtendedMappings mappings,
- Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
- return new ClassPropertyHolder( persistentClass, clazzToProcess, entityBinder, mappings, inheritanceStatePerClass );
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
+ return new ClassPropertyHolder(
+ persistentClass, clazzToProcess, entityBinder, mappings, inheritanceStatePerClass
+ );
}
/**
@@ -62,9 +62,11 @@
* @return PropertyHolder
*/
public static PropertyHolder buildPropertyHolder(
- Component component, String path, PropertyData inferredData, PropertyHolder parent,
- ExtendedMappings mappings
- ) {
+ Component component,
+ String path,
+ PropertyData inferredData,
+ PropertyHolder parent,
+ Mappings mappings) {
return new ComponentPropertyHolder( component, path, inferredData, parent, mappings );
}
@@ -72,20 +74,25 @@
* buid a property holder on top of a collection
*/
public static PropertyHolder buildPropertyHolder(
- Collection collection, String path, XClass clazzToProcess, XProperty property,
- PropertyHolder parentPropertyHolder, ExtendedMappings mappings
- ) {
- return new CollectionPropertyHolder( collection, path, clazzToProcess, property, parentPropertyHolder, mappings );
+ Collection collection,
+ String path,
+ XClass clazzToProcess,
+ XProperty property,
+ PropertyHolder parentPropertyHolder,
+ Mappings mappings) {
+ return new CollectionPropertyHolder(
+ collection, path, clazzToProcess, property, parentPropertyHolder, mappings
+ );
}
/**
* must only be used on second level phases (<join> has to be settled already)
*/
public static PropertyHolder buildPropertyHolder(
- PersistentClass persistentClass, Map<String, Join> joins,
- ExtendedMappings mappings,
- Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
+ PersistentClass persistentClass,
+ Map<String, Join> joins,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
return new ClassPropertyHolder( persistentClass, null, joins, mappings, inheritanceStatePerClass );
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/ToOneBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/ToOneBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/ToOneBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -38,7 +38,7 @@
* @author Emmanuel Bernard
*/
public class ToOneBinder {
- public static String getReferenceEntityName(PropertyData propertyData, XClass targetEntity, ExtendedMappings mappings) {
+ public static String getReferenceEntityName(PropertyData propertyData, XClass targetEntity, Mappings mappings) {
if ( AnnotationBinder.isDefault( targetEntity, mappings ) ) {
return propertyData.getClassOrElementName();
}
@@ -47,7 +47,7 @@
}
}
- public static String getReferenceEntityName(PropertyData propertyData, ExtendedMappings mappings) {
+ public static String getReferenceEntityName(PropertyData propertyData, Mappings mappings) {
XClass targetEntity = getTargetEntity( propertyData, mappings );
if ( AnnotationBinder.isDefault( targetEntity, mappings ) ) {
return propertyData.getClassOrElementName();
@@ -57,7 +57,7 @@
}
}
- public static XClass getTargetEntity(PropertyData propertyData, ExtendedMappings mappings) {
+ public static XClass getTargetEntity(PropertyData propertyData, Mappings mappings) {
XProperty property = propertyData.getProperty();
return mappings.getReflectionManager().toXClass( getTargetEntityClass( property ) );
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/ToOneFkSecondPass.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -47,13 +47,17 @@
*/
public class ToOneFkSecondPass extends FkSecondPass {
private boolean unique;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private String path;
private String entityClassName;
public ToOneFkSecondPass(
- ToOne value, Ejb3JoinColumn[] columns, boolean unique, String entityClassName, String path, ExtendedMappings mappings
- ) {
+ ToOne value,
+ Ejb3JoinColumn[] columns,
+ boolean unique,
+ String entityClassName,
+ String path,
+ Mappings mappings) {
super( value, columns );
this.mappings = mappings;
this.unique = unique;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -34,12 +34,14 @@
* @author Hardy Ferentschik
*/
public class VerifyFetchProfileReferenceSecondPass implements SecondPass {
-
private String fetchProfileName;
private FetchProfile.FetchOverride fetch;
- private ExtendedMappings mappings;
+ private Mappings mappings;
- public VerifyFetchProfileReferenceSecondPass(String fetchProfileName, FetchProfile.FetchOverride fetch, ExtendedMappings mappings) {
+ public VerifyFetchProfileReferenceSecondPass(
+ String fetchProfileName,
+ FetchProfile.FetchOverride fetch,
+ Mappings mappings) {
this.fetchProfileName = fetchProfileName;
this.fetch = fetch;
this.mappings = mappings;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -85,9 +85,9 @@
import org.hibernate.cfg.CollectionSecondPass;
import org.hibernate.cfg.Ejb3Column;
import org.hibernate.cfg.Ejb3JoinColumn;
-import org.hibernate.cfg.ExtendedMappings;
import org.hibernate.cfg.IndexColumn;
import org.hibernate.cfg.InheritanceState;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.PropertyData;
import org.hibernate.cfg.PropertyHolder;
import org.hibernate.cfg.PropertyHolderBuilder;
@@ -121,7 +121,6 @@
*/
@SuppressWarnings({"unchecked", "serial"})
public abstract class CollectionBinder {
-
private Logger log = LoggerFactory.getLogger( CollectionBinder.class );
protected Collection collection;
@@ -131,7 +130,7 @@
private String mappedBy;
private XClass collectionType;
private XClass targetEntity;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private Ejb3JoinColumn[] inverseJoinColumns;
private String cascadeStrategy;
String cacheConcurrencyStrategy;
@@ -163,7 +162,7 @@
private AccessType accessType;
private boolean hibernateExtensionMapping;
- protected ExtendedMappings getMappings() {
+ protected Mappings getMappings() {
return mappings;
}
@@ -244,9 +243,10 @@
* collection binder factory
*/
public static CollectionBinder getCollectionBinder(
- String entityName, XProperty property,
- boolean isIndexed, boolean isHibernateExtensionMapping
- ) {
+ String entityName,
+ XProperty property,
+ boolean isIndexed,
+ boolean isHibernateExtensionMapping) {
CollectionBinder result;
if ( property.isArray() ) {
if ( property.getElementClass().isPrimitive() ) {
@@ -351,7 +351,7 @@
this.targetEntity = targetEntity;
}
- public void setMappings(ExtendedMappings mappings) {
+ public void setMappings(Mappings mappings) {
this.mappings = mappings;
}
@@ -610,23 +610,25 @@
}
public SecondPass getSecondPass(
- final Ejb3JoinColumn[] fkJoinColumns, final Ejb3JoinColumn[] keyColumns,
+ final Ejb3JoinColumn[] fkJoinColumns,
+ final Ejb3JoinColumn[] keyColumns,
final Ejb3JoinColumn[] inverseColumns,
final Ejb3Column[] elementColumns,
- final Ejb3Column[] mapKeyColumns, final Ejb3JoinColumn[] mapKeyManyToManyColumns, final boolean isEmbedded,
- final XProperty property, final XClass collType,
- final boolean ignoreNotFound, final boolean unique,
- final TableBinder assocTableBinder, final ExtendedMappings mappings
- ) {
+ final Ejb3Column[] mapKeyColumns,
+ final Ejb3JoinColumn[] mapKeyManyToManyColumns,
+ final boolean isEmbedded,
+ final XProperty property,
+ final XClass collType,
+ final boolean ignoreNotFound,
+ final boolean unique,
+ final TableBinder assocTableBinder,
+ final Mappings mappings) {
return new CollectionSecondPass( mappings, collection ) {
-
- public void secondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas)
- throws MappingException {
+ public void secondPass(java.util.Map persistentClasses, java.util.Map inheritedMetas) throws MappingException {
bindStarToManySecondPass(
persistentClasses, collType, fkJoinColumns, keyColumns, inverseColumns, elementColumns,
isEmbedded, property, unique, assocTableBinder, ignoreNotFound, mappings
);
-
}
};
}
@@ -635,13 +637,18 @@
* return true if it's a Fk, false if it's an association table
*/
protected boolean bindStarToManySecondPass(
- Map persistentClasses, XClass collType, Ejb3JoinColumn[] fkJoinColumns,
- Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns,
+ Map persistentClasses,
+ XClass collType,
+ Ejb3JoinColumn[] fkJoinColumns,
+ Ejb3JoinColumn[] keyColumns,
+ Ejb3JoinColumn[] inverseColumns,
+ Ejb3Column[] elementColumns,
boolean isEmbedded,
- XProperty property, boolean unique,
+ XProperty property,
+ boolean unique,
TableBinder associationTableBinder,
- boolean ignoreNotFound, ExtendedMappings mappings
- ) {
+ boolean ignoreNotFound,
+ Mappings mappings) {
PersistentClass persistentClass = (PersistentClass) persistentClasses.get( collType.getName() );
boolean reversePropertyInJoin = false;
if ( persistentClass != null && StringHelper.isNotEmpty( this.mappedBy ) ) {
@@ -699,14 +706,17 @@
}
protected void bindOneToManySecondPass(
- Collection collection, Map persistentClasses, Ejb3JoinColumn[] fkJoinColumns,
+ Collection collection,
+ Map persistentClasses,
+ Ejb3JoinColumn[] fkJoinColumns,
XClass collectionType,
- boolean cascadeDeleteEnabled, boolean ignoreNotFound, String hqlOrderBy, ExtendedMappings extendedMappings,
- Map<XClass, InheritanceState> inheritanceStatePerClass
- ) {
-
+ boolean cascadeDeleteEnabled,
+ boolean ignoreNotFound,
+ String hqlOrderBy,
+ Mappings mappings,
+ Map<XClass, InheritanceState> inheritanceStatePerClass) {
log.debug("Binding a OneToMany: {}.{} through a foreign key", propertyHolder.getEntityName(), propertyName);
- org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( extendedMappings, collection.getOwner() );
+ org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( mappings, collection.getOwner() );
collection.setElement( oneToMany );
oneToMany.setReferencedEntityName( collectionType.getName() );
oneToMany.setIgnoreNotFound( ignoreNotFound );
@@ -1076,7 +1086,7 @@
private static SimpleValue buildCollectionKey(
Collection collValue, Ejb3JoinColumn[] joinColumns, boolean cascadeDeleteEnabled,
- XProperty property, ExtendedMappings mappings
+ XProperty property, Mappings mappings
) {
//binding key reference using column
KeyValue keyVal;
@@ -1127,9 +1137,11 @@
XClass collType,
boolean ignoreNotFound, boolean unique,
boolean cascadeDeleteEnabled,
- TableBinder associationTableBinder, XProperty property, PropertyHolder parentPropertyHolder,
- String hqlOrderBy, ExtendedMappings mappings
- ) throws MappingException {
+ TableBinder associationTableBinder,
+ XProperty property,
+ PropertyHolder parentPropertyHolder,
+ String hqlOrderBy,
+ Mappings mappings) throws MappingException {
PersistentClass collectionEntity = (PersistentClass) persistentClasses.get( collType.getName() );
boolean isCollectionOfEntities = collectionEntity != null;
@@ -1415,10 +1427,12 @@
}
private static void bindCollectionSecondPass(
- Collection collValue, PersistentClass collectionEntity, Ejb3JoinColumn[] joinColumns,
- boolean cascadeDeleteEnabled, XProperty property,
- ExtendedMappings mappings
- ) {
+ Collection collValue,
+ PersistentClass collectionEntity,
+ Ejb3JoinColumn[] joinColumns,
+ boolean cascadeDeleteEnabled,
+ XProperty property,
+ Mappings mappings) {
BinderHelper.createSyntheticPropertyReference(
joinColumns, collValue.getOwner(), collectionEntity, collValue, false, mappings
);
@@ -1450,9 +1464,11 @@
* Otherwise delegates to the usual algorithm
*/
public static void bindManytoManyInverseFk(
- PersistentClass referencedEntity, Ejb3JoinColumn[] columns, SimpleValue value, boolean unique,
- ExtendedMappings mappings
- ) {
+ PersistentClass referencedEntity,
+ Ejb3JoinColumn[] columns,
+ SimpleValue value,
+ boolean unique,
+ Mappings mappings) {
final String mappedBy = columns[0].getMappedBy();
if ( StringHelper.isNotEmpty( mappedBy ) ) {
final Property property = referencedEntity.getRecursiveProperty( mappedBy );
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -66,8 +66,8 @@
import org.hibernate.cfg.AnnotationBinder;
import org.hibernate.cfg.BinderHelper;
import org.hibernate.cfg.Ejb3JoinColumn;
-import org.hibernate.cfg.ExtendedMappings;
import org.hibernate.cfg.InheritanceState;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.PropertyHolder;
import org.hibernate.cfg.ObjectNameSource;
import org.hibernate.cfg.NamingStrategy;
@@ -99,7 +99,7 @@
private String name;
private XClass annotatedClass;
private PersistentClass persistentClass;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private Logger log = LoggerFactory.getLogger( EntityBinder.class );
private String discriminatorValue = "";
private boolean dynamicInsert;
@@ -136,10 +136,11 @@
}
public EntityBinder(
- Entity ejb3Ann, org.hibernate.annotations.Entity hibAnn,
- XClass annotatedClass, PersistentClass persistentClass,
- ExtendedMappings mappings
- ) {
+ Entity ejb3Ann,
+ org.hibernate.annotations.Entity hibAnn,
+ XClass annotatedClass,
+ PersistentClass persistentClass,
+ Mappings mappings) {
this.mappings = mappings;
this.persistentClass = persistentClass;
this.annotatedClass = annotatedClass;
@@ -479,9 +480,12 @@
}
public void bindTable(
- String schema, String catalog,
- String tableName, List<UniqueConstraintHolder> uniqueConstraints,
- String constraints, Table denormalizedSuperclassTable) {
+ String schema,
+ String catalog,
+ String tableName,
+ List<UniqueConstraintHolder> uniqueConstraints,
+ String constraints,
+ Table denormalizedSuperclassTable) {
EntityTableObjectNameSource tableNameContext = new EntityTableObjectNameSource( tableName, name );
EntityTableNamingStrategyHelper namingStrategyHelper = new EntityTableNamingStrategyHelper( name );
final Table table = TableBinder.buildAndFillTable(
@@ -589,7 +593,7 @@
bindJoinToPersistentClass( join, ejb3JoinColumns, mappings );
}
- private void bindJoinToPersistentClass(Join join, Ejb3JoinColumn[] ejb3JoinColumns, ExtendedMappings mappings) {
+ private void bindJoinToPersistentClass(Join join, Ejb3JoinColumn[] ejb3JoinColumns, Mappings mappings) {
SimpleValue key = new DependantValue( mappings, join.getTable(), persistentClass.getIdentifier() );
join.setKey( key );
setFKNameIfDefined( join );
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -34,7 +34,7 @@
import org.hibernate.cfg.BinderHelper;
import org.hibernate.cfg.Ejb3Column;
import org.hibernate.cfg.Ejb3JoinColumn;
-import org.hibernate.cfg.ExtendedMappings;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.PropertyData;
import org.hibernate.cfg.PropertyInferredData;
import org.hibernate.cfg.WrappedInferredData;
@@ -55,10 +55,18 @@
@Override
protected boolean bindStarToManySecondPass(
- Map persistentClasses, XClass collType, Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns,
- Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, boolean isEmbedded, XProperty property,
- boolean unique, TableBinder associationTableBinder, boolean ignoreNotFound, ExtendedMappings mappings
- ) {
+ Map persistentClasses,
+ XClass collType,
+ Ejb3JoinColumn[] fkJoinColumns,
+ Ejb3JoinColumn[] keyColumns,
+ Ejb3JoinColumn[] inverseColumns,
+ Ejb3Column[] elementColumns,
+ boolean isEmbedded,
+ XProperty property,
+ boolean unique,
+ TableBinder associationTableBinder,
+ boolean ignoreNotFound,
+ Mappings mappings) {
boolean result = super.bindStarToManySecondPass(
persistentClasses, collType, fkJoinColumns, keyColumns, inverseColumns, elementColumns, isEmbedded,
property, unique, associationTableBinder, ignoreNotFound, mappings
@@ -68,9 +76,14 @@
SimpleValueBinder simpleValue = new SimpleValueBinder();
PropertyData propertyData = new WrappedInferredData(
- new PropertyInferredData( null, property, null, //default access should not be useful
- mappings.getReflectionManager() ),
- "id" );
+ new PropertyInferredData(
+ null,
+ property,
+ null, //default access should not be useful
+ mappings.getReflectionManager()
+ ),
+ "id"
+ );
Ejb3Column[] idColumns = Ejb3Column.buildColumnFromAnnotation(
collectionIdAnn.columns(),
null,
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ListBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -37,7 +37,7 @@
import org.hibernate.cfg.CollectionSecondPass;
import org.hibernate.cfg.Ejb3Column;
import org.hibernate.cfg.Ejb3JoinColumn;
-import org.hibernate.cfg.ExtendedMappings;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.PropertyHolder;
import org.hibernate.cfg.PropertyHolderBuilder;
import org.hibernate.cfg.SecondPass;
@@ -76,14 +76,19 @@
@Override
public SecondPass getSecondPass(
- final Ejb3JoinColumn[] fkJoinColumns, final Ejb3JoinColumn[] keyColumns,
+ final Ejb3JoinColumn[] fkJoinColumns,
+ final Ejb3JoinColumn[] keyColumns,
final Ejb3JoinColumn[] inverseColumns,
final Ejb3Column[] elementColumns,
- Ejb3Column[] mapKeyColumns, final Ejb3JoinColumn[] mapKeyManyToManyColumns, final boolean isEmbedded,
- final XProperty property, final XClass collType,
- final boolean ignoreNotFound, final boolean unique,
- final TableBinder assocTableBinder, final ExtendedMappings mappings
- ) {
+ Ejb3Column[] mapKeyColumns,
+ final Ejb3JoinColumn[] mapKeyManyToManyColumns,
+ final boolean isEmbedded,
+ final XProperty property,
+ final XClass collType,
+ final boolean ignoreNotFound,
+ final boolean unique,
+ final TableBinder assocTableBinder,
+ final Mappings mappings) {
return new CollectionSecondPass( mappings, ListBinder.this.collection ) {
public void secondPass(Map persistentClasses, Map inheritedMetas)
throws MappingException {
@@ -96,7 +101,7 @@
};
}
- private void bindIndex(final ExtendedMappings mappings) {
+ private void bindIndex(final Mappings mappings) {
if ( !indexColumn.isImplicit() ) {
PropertyHolder valueHolder = PropertyHolderBuilder.buildPropertyHolder(
this.collection,
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/MapBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -46,7 +46,7 @@
import org.hibernate.cfg.CollectionSecondPass;
import org.hibernate.cfg.Ejb3Column;
import org.hibernate.cfg.Ejb3JoinColumn;
-import org.hibernate.cfg.ExtendedMappings;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.PropertyData;
import org.hibernate.cfg.PropertyHolder;
import org.hibernate.cfg.PropertyHolderBuilder;
@@ -93,14 +93,19 @@
@Override
public SecondPass getSecondPass(
- final Ejb3JoinColumn[] fkJoinColumns, final Ejb3JoinColumn[] keyColumns,
+ final Ejb3JoinColumn[] fkJoinColumns,
+ final Ejb3JoinColumn[] keyColumns,
final Ejb3JoinColumn[] inverseColumns,
final Ejb3Column[] elementColumns,
- final Ejb3Column[] mapKeyColumns, final Ejb3JoinColumn[] mapKeyManyToManyColumns, final boolean isEmbedded,
- final XProperty property, final XClass collType,
- final boolean ignoreNotFound, final boolean unique,
- final TableBinder assocTableBinder, final ExtendedMappings mappings
- ) {
+ final Ejb3Column[] mapKeyColumns,
+ final Ejb3JoinColumn[] mapKeyManyToManyColumns,
+ final boolean isEmbedded,
+ final XProperty property,
+ final XClass collType,
+ final boolean ignoreNotFound,
+ final boolean unique,
+ final TableBinder assocTableBinder,
+ final Mappings mappings) {
return new CollectionSecondPass( mappings, MapBinder.this.collection ) {
public void secondPass(Map persistentClasses, Map inheritedMetas)
throws MappingException {
@@ -118,10 +123,15 @@
}
private void bindKeyFromAssociationTable(
- XClass collType, Map persistentClasses, String mapKeyPropertyName, XProperty property,
- boolean isEmbedded, ExtendedMappings mappings, Ejb3Column[] mapKeyColumns,
- Ejb3JoinColumn[] mapKeyManyToManyColumns, String targetPropertyName
- ) {
+ XClass collType,
+ Map persistentClasses,
+ String mapKeyPropertyName,
+ XProperty property,
+ boolean isEmbedded,
+ Mappings mappings,
+ Ejb3Column[] mapKeyColumns,
+ Ejb3JoinColumn[] mapKeyManyToManyColumns,
+ String targetPropertyName) {
if ( mapKeyPropertyName != null ) {
//this is an EJB3 @MapKey
PersistentClass associatedClass = (PersistentClass) persistentClasses.get( collType.getName() );
@@ -133,7 +143,9 @@
);
}
org.hibernate.mapping.Map map = (org.hibernate.mapping.Map) this.collection;
- Value indexValue = createFormulatedValue( mapProperty.getValue(), map, targetPropertyName, associatedClass, mappings );
+ Value indexValue = createFormulatedValue(
+ mapProperty.getValue(), map, targetPropertyName, associatedClass, mappings
+ );
map.setIndex( indexValue );
}
else {
@@ -305,7 +317,7 @@
Collection collection,
String targetPropertyName,
PersistentClass associatedClass,
- ExtendedMappings mappings) {
+ Mappings mappings) {
Value element = collection.getElement();
String fromAndWhere = null;
if ( !( element instanceof OneToMany ) ) {
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/PropertyBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -43,8 +43,8 @@
import org.hibernate.cfg.AnnotationBinder;
import org.hibernate.cfg.BinderHelper;
import org.hibernate.cfg.Ejb3Column;
-import org.hibernate.cfg.ExtendedMappings;
import org.hibernate.cfg.InheritanceState;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.PropertyHolder;
import org.hibernate.cfg.PropertyPreloadedData;
import org.hibernate.mapping.Component;
@@ -67,7 +67,7 @@
private AccessType accessType;
private Ejb3Column[] columns;
private PropertyHolder holder;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private Value value;
private boolean insertable = true;
private boolean updatable = true;
@@ -145,7 +145,7 @@
this.cascade = cascadeStrategy;
}
- public void setMappings(ExtendedMappings mappings) {
+ public void setMappings(Mappings mappings) {
this.mappings = mappings;
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -40,7 +40,7 @@
import org.hibernate.annotations.CacheModeType;
import org.hibernate.annotations.FlushModeType;
import org.hibernate.cfg.BinderHelper;
-import org.hibernate.cfg.ExtendedMappings;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.NotYetImplementedException;
import org.hibernate.engine.NamedQueryDefinition;
import org.hibernate.engine.NamedSQLQueryDefinition;
@@ -57,7 +57,7 @@
public abstract class QueryBinder {
private static final Logger log = LoggerFactory.getLogger( QueryBinder.class );
- public static void bindQuery(NamedQuery queryAnn, ExtendedMappings mappings, boolean isDefault) {
+ public static void bindQuery(NamedQuery queryAnn, Mappings mappings, boolean isDefault) {
if ( queryAnn == null ) return;
if ( BinderHelper.isDefault( queryAnn.name() ) ) {
throw new AnnotationException( "A named query must have a name when used in class or package level" );
@@ -87,7 +87,7 @@
}
- public static void bindNativeQuery(NamedNativeQuery queryAnn, ExtendedMappings mappings, boolean isDefault) {
+ public static void bindNativeQuery(NamedNativeQuery queryAnn, Mappings mappings, boolean isDefault) {
if ( queryAnn == null ) return;
//ResultSetMappingDefinition mappingDefinition = mappings.getResultSetMapping( queryAnn.resultSetMapping() );
if ( BinderHelper.isDefault( queryAnn.name() ) ) {
@@ -148,7 +148,7 @@
log.info( "Binding named native query: {} => {}", queryAnn.name(), queryAnn.query() );
}
- public static void bindNativeQuery(org.hibernate.annotations.NamedNativeQuery queryAnn, ExtendedMappings mappings) {
+ public static void bindNativeQuery(org.hibernate.annotations.NamedNativeQuery queryAnn, Mappings mappings) {
if ( queryAnn == null ) return;
//ResultSetMappingDefinition mappingDefinition = mappings.getResultSetMapping( queryAnn.resultSetMapping() );
if ( BinderHelper.isDefault( queryAnn.name() ) ) {
@@ -202,14 +202,14 @@
log.info( "Binding named native query: {} => {}", queryAnn.name(), queryAnn.query() );
}
- public static void bindQueries(NamedQueries queriesAnn, ExtendedMappings mappings, boolean isDefault) {
+ public static void bindQueries(NamedQueries queriesAnn, Mappings mappings, boolean isDefault) {
if ( queriesAnn == null ) return;
for (NamedQuery q : queriesAnn.value()) {
bindQuery( q, mappings, isDefault );
}
}
- public static void bindNativeQueries(NamedNativeQueries queriesAnn, ExtendedMappings mappings, boolean isDefault) {
+ public static void bindNativeQueries(NamedNativeQueries queriesAnn, Mappings mappings, boolean isDefault) {
if ( queriesAnn == null ) return;
for (NamedNativeQuery q : queriesAnn.value()) {
bindNativeQuery( q, mappings, isDefault );
@@ -217,7 +217,7 @@
}
public static void bindNativeQueries(
- org.hibernate.annotations.NamedNativeQueries queriesAnn, ExtendedMappings mappings
+ org.hibernate.annotations.NamedNativeQueries queriesAnn, Mappings mappings
) {
if ( queriesAnn == null ) return;
for (org.hibernate.annotations.NamedNativeQuery q : queriesAnn.value()) {
@@ -225,7 +225,7 @@
}
}
- public static void bindQuery(org.hibernate.annotations.NamedQuery queryAnn, ExtendedMappings mappings) {
+ public static void bindQuery(org.hibernate.annotations.NamedQuery queryAnn, Mappings mappings) {
if ( queryAnn == null ) return;
if ( BinderHelper.isDefault( queryAnn.name() ) ) {
throw new AnnotationException( "A named query must have a name when used in class or package level" );
@@ -296,14 +296,14 @@
}
- public static void bindQueries(org.hibernate.annotations.NamedQueries queriesAnn, ExtendedMappings mappings) {
+ public static void bindQueries(org.hibernate.annotations.NamedQueries queriesAnn, Mappings mappings) {
if ( queriesAnn == null ) return;
for (org.hibernate.annotations.NamedQuery q : queriesAnn.value()) {
bindQuery( q, mappings );
}
}
- public static void bindSqlResultsetMappings(SqlResultSetMappings ann, ExtendedMappings mappings, boolean isDefault) {
+ public static void bindSqlResultsetMappings(SqlResultSetMappings ann, Mappings mappings, boolean isDefault) {
if ( ann == null ) return;
for (SqlResultSetMapping rs : ann.value()) {
//no need to handle inSecondPass
@@ -311,7 +311,7 @@
}
}
- public static void bindSqlResultsetMapping(SqlResultSetMapping ann, ExtendedMappings mappings, boolean isDefault) {
+ public static void bindSqlResultsetMapping(SqlResultSetMapping ann, Mappings mappings, boolean isDefault) {
//no need to handle inSecondPass
mappings.addSecondPass( new ResultsetMappingSecondPass( ann, mappings, isDefault ) );
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/ResultsetMappingSecondPass.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -38,7 +38,7 @@
import org.hibernate.LockMode;
import org.hibernate.MappingException;
import org.hibernate.cfg.BinderHelper;
-import org.hibernate.cfg.ExtendedMappings;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.QuerySecondPass;
import org.hibernate.engine.ResultSetMappingDefinition;
import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn;
@@ -58,10 +58,10 @@
public class ResultsetMappingSecondPass implements QuerySecondPass {
private Logger log = LoggerFactory.getLogger( ResultsetMappingSecondPass.class );
private SqlResultSetMapping ann;
- private ExtendedMappings mappings;
+ private Mappings mappings;
private boolean isDefault;
- public ResultsetMappingSecondPass(SqlResultSetMapping ann, ExtendedMappings mappings, boolean isDefault) {
+ public ResultsetMappingSecondPass(SqlResultSetMapping ann, Mappings mappings, boolean isDefault) {
this.ann = ann;
this.mappings = mappings;
this.isDefault = isDefault;
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -48,7 +48,7 @@
import org.hibernate.cfg.BinderHelper;
import org.hibernate.cfg.Ejb3Column;
import org.hibernate.cfg.Ejb3JoinColumn;
-import org.hibernate.cfg.ExtendedMappings;
+import org.hibernate.cfg.Mappings;
import org.hibernate.cfg.NotYetImplementedException;
import org.hibernate.cfg.PkDrivenByDefaultMapsIdSecondPass;
import org.hibernate.cfg.SetSimpleValueTypeSecondPass;
@@ -72,7 +72,7 @@
private String persistentClassName;
private String explicitType = "";
private Properties typeParameters = new Properties();
- private ExtendedMappings mappings;
+ private Mappings mappings;
private Table table;
private SimpleValue simpleValue;
private boolean isVersion;
@@ -278,7 +278,7 @@
}
}
- public void setMappings(ExtendedMappings mappings) {
+ public void setMappings(Mappings mappings) {
this.mappings = mappings;
}
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java 2010-08-12 17:01:49 UTC (rev 20135)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/annotations/TableBinder.java 2010-08-12 19:13:48 UTC (rev 20136)
@@ -31,11 +31,11 @@
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.annotations.Index;
+import org.hibernate.cfg.Mappings;
import org.hibernate.util.StringHelper;
import org.hibernate.util.CollectionHelper;
import org.hibernate.cfg.BinderHelper;
import org.hibernate.cfg.Ejb3JoinColumn;
-import org.hibernate.cfg.ExtendedMappings;
import org.hibernate.cfg.IndexOrUniqueKeySecondPass;
import org.hibernate.cfg.ObjectNameNormalizer;
import org.hibernate.cfg.ObjectNameSource;
@@ -71,7 +71,7 @@
// private List<String[]> uniqueConstraints;
String constraints;
Table denormalizedSuperTable;
- ExtendedMappings mappings;
+ Mappings mappings;
private String ownerEntityTable;
private String associatedEntityTable;
private String propertyName;
@@ -111,7 +111,7 @@
this.denormalizedSuperTable = denormalizedSuperTable;
}
- public void setMappings(ExtendedMappings mappings) {
+ public void setMappings(Mappings mappings) {
this.mappings = mappings;
}
@@ -211,7 +211,7 @@
List<UniqueConstraintHolder> uniqueConstraints,
String constraints,
Table denormalizedSuperTable,
- ExtendedMappings mappings,
+ Mappings mappings,
String subselect) {
schema = BinderHelper.isDefault( schema ) ? mappings.getSchemaName() : schema;
catalog = BinderHelper.isDefault( catalog ) ? mappings.getCatalogName() : catalog;
@@ -273,9 +273,15 @@
*/
@SuppressWarnings({ "JavaDoc" })
public static Table fillTable(
- String schema, String catalog, String realTableName, String logicalName, boolean isAbstract,
- List uniqueConstraints, String constraints, Table denormalizedSuperTable, ExtendedMappings mappings
- ) {
+ String schema,
+ String catalog,
+ String realTableName,
+ String logicalName,
+ boolean isAbstract,
+ List uniqueConstraints,
+ String constraints,
+ Table denormalizedSuperTable,
+ Mappings mappings) {
schema = BinderHelper.isDefault( schema ) ? mappings.getSchemaName() : schema;
catalog = BinderHelper.isDefault( catalog ) ? mappings.getCatalogName() : catalog;
Table table;
@@ -310,10 +316,12 @@
}
public static void bindFk(
- PersistentClass referencedEntity, PersistentClass destinationEntity, Ejb3JoinColumn[] columns,
+ PersistentClass referencedEntity,
+ PersistentClass destinationEntity,
+ Ejb3JoinColumn[] columns,
SimpleValue value,
- boolean unique, ExtendedMappings mappings
- ) {
+ boolean unique,
+ Mappings mappings) {
PersistentClass associatedClass;
if ( destinationEntity != null ) {
//overridden destination
@@ -478,8 +486,10 @@
}
public static void linkJoinColumnWithValueOverridingNameIfImplicit(
- PersistentClass referencedEntity, Iterator columnIterator, Ejb3JoinColumn[] columns, SimpleValue value
- ) {
+ PersistentClass referencedEntity,
+ Iterator columnIterator,
+ Ejb3JoinColumn[] columns,
+ SimpleValue value) {
for (Ejb3JoinColumn joinCol : columns) {
Column synthCol = (Column) columnIterator.next();
if ( joinCol.isNameDeferred() ) {
@@ -502,7 +512,7 @@
value.getTable().createUniqueKey( cols );
}
- public static void addIndexes(Table hibTable, Index[] indexes, ExtendedMappings mappings) {
+ public static void addIndexes(Table hibTable, Index[] indexes, Mappings mappings) {
for (Index index : indexes) {
//no need to handle inSecondPass here since it is only called from EntityBinder
mappings.addSecondPass(
13 years, 9 months
Hibernate SVN: r20135 - in core/trunk/core/src/main/java/org/hibernate: engine/query and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-12 13:01:49 -0400 (Thu, 12 Aug 2010)
New Revision: 20135
Added:
core/trunk/core/src/main/java/org/hibernate/util/LRUMap.java
Modified:
core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java
core/trunk/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
core/trunk/core/src/main/java/org/hibernate/util/SoftLimitMRUCache.java
Log:
HHH-5300 - Configurable strong and soft reference QueryPlanCache sizes
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java 2010-08-11 20:37:49 UTC (rev 20134)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Environment.java 2010-08-12 17:01:49 UTC (rev 20135)
@@ -537,6 +537,17 @@
*/
public static final String PREFER_POOLED_VALUES_LO = "hibernate.id.optimizer.pooled.prefer_lo";
+ /**
+ * The maximum number of strong references maintained by {@link org.hibernate.util.SoftLimitMRUCache}. Default is 128.
+ */
+ public static final String QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES = "hibernate.query.plan_cache_max_strong_references";
+
+ /**
+ * The maximum number of soft references maintained by {@link org.hibernate.util.SoftLimitMRUCache}. Default is 2048.
+ */
+ public static final String QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES = "hibernate.query.plan_cache_max_soft_references";
+
+
private static final BytecodeProvider BYTECODE_PROVIDER_INSTANCE;
private static final boolean ENABLE_BINARY_STREAMS;
private static final boolean ENABLE_REFLECTION_OPTIMIZER;
Modified: core/trunk/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java 2010-08-11 20:37:49 UTC (rev 20134)
+++ core/trunk/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java 2010-08-12 17:01:49 UTC (rev 20135)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,13 +20,14 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.engine.query;
+import org.hibernate.util.PropertiesHelper;
import org.hibernate.util.SimpleMRUCache;
import org.hibernate.util.SoftLimitMRUCache;
import org.hibernate.util.CollectionHelper;
+import org.hibernate.cfg.Environment;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.query.sql.NativeSQLQuerySpecification;
import org.hibernate.QueryException;
@@ -48,6 +49,9 @@
/**
* Acts as a cache for compiled query plans, as well as query-parameter metadata.
*
+ * @see Environment#QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES
+ * @see Environment#QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES
+ *
* @author Steve Ebersole
*/
public class QueryPlanCache implements Serializable {
@@ -57,29 +61,51 @@
private SessionFactoryImplementor factory;
public QueryPlanCache(SessionFactoryImplementor factory) {
+ int maxStrongReferenceCount = PropertiesHelper.getInt(
+ Environment.QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES,
+ factory.getProperties(),
+ SoftLimitMRUCache.DEFAULT_STRONG_REF_COUNT
+ );
+ int maxSoftReferenceCount = PropertiesHelper.getInt(
+ Environment.QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES,
+ factory.getProperties(),
+ SoftLimitMRUCache.DEFAULT_SOFT_REF_COUNT
+ );
+
this.factory = factory;
+ this.sqlParamMetadataCache = new SimpleMRUCache( maxStrongReferenceCount );
+ this.planCache = new SoftLimitMRUCache( maxStrongReferenceCount, maxSoftReferenceCount );
}
- // simple cache of param metadata based on query string. Ideally, the
- // original "user-supplied query" string should be used to retreive this
- // metadata (i.e., not the para-list-expanded query string) to avoid
- // unnecessary cache entries.
- // Used solely for caching param metadata for native-sql queries, see
- // getSQLParameterMetadata() for a discussion as to why...
- private final SimpleMRUCache sqlParamMetadataCache = new SimpleMRUCache();
+ /**
+ * simple cache of param metadata based on query string. Ideally, the original "user-supplied query"
+ * string should be used to obtain this metadata (i.e., not the para-list-expanded query string) to avoid
+ * unnecessary cache entries.
+ * <p>
+ * Used solely for caching param metadata for native-sql queries, see {@link #getSQLParameterMetadata} for a
+ * discussion as to why...
+ */
+ private final SimpleMRUCache sqlParamMetadataCache;
- // the cache of the actual plans...
- private final SoftLimitMRUCache planCache = new SoftLimitMRUCache( 128 );
+ /**
+ * the cache of the actual plans...
+ */
+ private final SoftLimitMRUCache planCache;
+ /**
+ * Obtain the parameter metadata for given native-sql query.
+ * <p/>
+ * for native-sql queries, the param metadata is determined outside any relation to a query plan, because
+ * query plan creation and/or retrieval for a native-sql query depends on all of the return types having been
+ * set, which might not be the case up-front when param metadata would be most useful
+ *
+ * @param query The query
+ * @return The parameter metadata
+ */
public ParameterMetadata getSQLParameterMetadata(String query) {
ParameterMetadata metadata = ( ParameterMetadata ) sqlParamMetadataCache.get( query );
if ( metadata == null ) {
- // for native-sql queries, the param metadata is determined outside
- // any relation to a query plan, because query plan creation and/or
- // retreival for a native-sql query depends on all of the return
- // types having been set, which might not be the case up-front when
- // param metadata would be most useful
metadata = buildNativeSQLParameterMetadata( query );
sqlParamMetadataCache.put( query, metadata );
}
@@ -149,6 +175,7 @@
return plan;
}
+ @SuppressWarnings({ "UnnecessaryUnboxing" })
private ParameterMetadata buildNativeSQLParameterMetadata(String sqlString) {
ParamLocationRecognizer recognizer = ParamLocationRecognizer.parseLocations( sqlString );
@@ -160,7 +187,7 @@
}
Iterator itr = recognizer.getNamedParameterDescriptionMap().entrySet().iterator();
- Map namedParamDescriptorMap = new HashMap();
+ Map<String,NamedParameterDescriptor> namedParamDescriptorMap = new HashMap<String,NamedParameterDescriptor>();
while( itr.hasNext() ) {
final Map.Entry entry = ( Map.Entry ) itr.next();
final String name = ( String ) entry.getKey();
@@ -178,7 +205,7 @@
private static class HQLQueryPlanKey implements Serializable {
private final String query;
private final boolean shallow;
- private final Set filterKeys;
+ private final Set<DynamicFilterKey> filterKeys;
private final int hashCode;
public HQLQueryPlanKey(String query, boolean shallow, Map enabledFilters) {
@@ -186,16 +213,15 @@
this.shallow = shallow;
if ( enabledFilters == null || enabledFilters.isEmpty() ) {
- filterKeys = Collections.EMPTY_SET;
+ filterKeys = Collections.emptySet();
}
else {
- Set tmp = new HashSet(
+ Set<DynamicFilterKey> tmp = new HashSet<DynamicFilterKey>(
CollectionHelper.determineProperSizing( enabledFilters ),
CollectionHelper.LOAD_FACTOR
);
- Iterator itr = enabledFilters.values().iterator();
- while ( itr.hasNext() ) {
- tmp.add( new DynamicFilterKey( ( FilterImpl ) itr.next() ) );
+ for ( Object o : enabledFilters.values() ) {
+ tmp.add( new DynamicFilterKey( (FilterImpl) o ) );
}
this.filterKeys = Collections.unmodifiableSet( tmp );
}
@@ -229,30 +255,31 @@
private static class DynamicFilterKey implements Serializable {
private final String filterName;
- private final Map parameterMetadata;
+ private final Map<String,Integer> parameterMetadata;
private final int hashCode;
+ @SuppressWarnings({ "UnnecessaryBoxing" })
private DynamicFilterKey(FilterImpl filter) {
this.filterName = filter.getName();
if ( filter.getParameters().isEmpty() ) {
- parameterMetadata = Collections.EMPTY_MAP;
+ parameterMetadata = Collections.emptyMap();
}
else {
- parameterMetadata = new HashMap(
+ parameterMetadata = new HashMap<String,Integer>(
CollectionHelper.determineProperSizing( filter.getParameters() ),
CollectionHelper.LOAD_FACTOR
);
- Iterator itr = filter.getParameters().entrySet().iterator();
- while ( itr.hasNext() ) {
+ for ( Object o : filter.getParameters().entrySet() ) {
+ final Map.Entry entry = (Map.Entry) o;
+ final String key = (String) entry.getKey();
final Integer valueCount;
- final Map.Entry entry = ( Map.Entry ) itr.next();
if ( Collection.class.isInstance( entry.getValue() ) ) {
valueCount = new Integer( ( (Collection) entry.getValue() ).size() );
}
else {
- valueCount = new Integer(1);
+ valueCount = new Integer( 1 );
}
- parameterMetadata.put( entry.getKey(), valueCount );
+ parameterMetadata.put( key, valueCount );
}
}
@@ -285,19 +312,20 @@
private final String query;
private final String collectionRole;
private final boolean shallow;
- private final Set filterNames;
+ private final Set<String> filterNames;
private final int hashCode;
+ @SuppressWarnings({ "unchecked" })
public FilterQueryPlanKey(String query, String collectionRole, boolean shallow, Map enabledFilters) {
this.query = query;
this.collectionRole = collectionRole;
this.shallow = shallow;
if ( enabledFilters == null || enabledFilters.isEmpty() ) {
- filterNames = Collections.EMPTY_SET;
+ filterNames = Collections.emptySet();
}
else {
- Set tmp = new HashSet();
+ Set<String> tmp = new HashSet<String>();
tmp.addAll( enabledFilters.keySet() );
this.filterNames = Collections.unmodifiableSet( tmp );
}
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-08-11 20:37:49 UTC (rev 20134)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-08-12 17:01:49 UTC (rev 20135)
@@ -185,7 +185,7 @@
private final transient SQLFunctionRegistry sqlFunctionRegistry;
private final transient SessionFactoryObserver observer;
private final transient HashMap entityNameResolvers = new HashMap();
- private final transient QueryPlanCache queryPlanCache = new QueryPlanCache( this );
+ private final transient QueryPlanCache queryPlanCache;
private final transient Cache cacheAccess = new CacheImpl();
private transient boolean isClosed = false;
private final transient TypeResolver typeResolver;
@@ -234,6 +234,7 @@
// Caches
settings.getRegionFactory().start( settings, properties );
+ this.queryPlanCache = new QueryPlanCache( this );
//Generators:
Added: core/trunk/core/src/main/java/org/hibernate/util/LRUMap.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/util/LRUMap.java (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/util/LRUMap.java 2010-08-12 17:01:49 UTC (rev 20135)
@@ -0,0 +1,50 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.util;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * A simple LRU cache that implements the <code>Map</code> interface. Instances
+ * are not thread-safe and should be synchronized externally, for instance by
+ * using {@link java.util.Collections#synchronizedMap}.
+ *
+ * @author Manuel Dominguez Sarmiento
+ */
+public class LRUMap extends LinkedHashMap implements Serializable {
+ private static final long serialVersionUID = -5522608033020688048L;
+
+ private final int maxEntries;
+
+ public LRUMap(int maxEntries) {
+ super( maxEntries, .75f, true );
+ this.maxEntries = maxEntries;
+ }
+
+ protected boolean removeEldestEntry(Map.Entry eldest) {
+ return ( size() > maxEntries );
+ }
+}
\ No newline at end of file
Modified: core/trunk/core/src/main/java/org/hibernate/util/SoftLimitMRUCache.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/util/SoftLimitMRUCache.java 2010-08-11 20:37:49 UTC (rev 20134)
+++ core/trunk/core/src/main/java/org/hibernate/util/SoftLimitMRUCache.java 2010-08-12 17:01:49 UTC (rev 20135)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -20,18 +20,16 @@
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
- *
*/
package org.hibernate.util;
-import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.commons.collections.map.LRUMap;
-
import java.io.Serializable;
import java.io.IOException;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.SoftReference;
/**
- * Cache following a "Most Recently Used" (MRY) algorithm for maintaining a
+ * Cache following a "Most Recently Used" (MRU) algorithm for maintaining a
* bounded in-memory size; the "Least Recently Used" (LRU) entry is the first
* available for removal from the cache.
* <p/>
@@ -39,60 +37,168 @@
* meaning that all cache entries are kept within a completely
* {@link java.lang.ref.SoftReference}-based map with the most recently utilized
* entries additionally kept in a hard-reference manner to prevent those cache
- * entries soft references from becoming enqueued by the garbage collector.
- * Thus the actual size of this cache impl can actually grow beyond the stated
- * max size bound as long as GC is not actively seeking soft references for
+ * entries soft references from becoming enqueued by the garbage collector. Thus
+ * the actual size of this cache impl can actually grow beyond the stated max
+ * size bound as long as GC is not actively seeking soft references for
* enqueuement.
+ * <p/>
+ * The soft-size is bounded and configurable. This allows controlling memory
+ * usage which can grow out of control under some circumstances, especially when
+ * very large heaps are in use. Although memory usage per se should not be a
+ * problem with soft references, which are cleared when necessary, this can
+ * trigger extremely slow stop-the-world GC pauses when nearing full heap usage,
+ * even with CMS concurrent GC (i.e. concurrent mode failure). This is most
+ * evident when ad-hoc HQL queries are produced by the application, leading to
+ * poor soft-cache hit ratios. This can also occur with heavy use of SQL IN
+ * clauses, which will generate multiples SQL queries (even if parameterized),
+ * one for each collection/array size passed to the IN clause. Many slightly
+ * different queries will eventually fill the heap and trigger a full GC to
+ * reclaim space, leading to unacceptable pauses in some cases.
+ * <p/>
+ * <strong>Note:</strong> This class is serializable, however all entries are
+ * discarded on serialization.
*
+ * @see org.hibernate.cfg.Environment#QUERY_PLAN_CACHE_MAX_STRONG_REFERENCES
+ * @see org.hibernate.cfg.Environment#QUERY_PLAN_CACHE_MAX_SOFT_REFERENCES
+ *
* @author Steve Ebersole
+ * @author Manuel Dominguez Sarmiento
*/
public class SoftLimitMRUCache implements Serializable {
-
+ /**
+ * The default strong reference count.
+ */
public static final int DEFAULT_STRONG_REF_COUNT = 128;
- private final int strongReferenceCount;
+ /**
+ * The default soft reference count.
+ */
+ public static final int DEFAULT_SOFT_REF_COUNT = 2048;
- // actual cache of the entries. soft references are used for both the keys and the
- // values here since the values pertaining to the MRU entries are kept in a
- // seperate hard reference cache (to avoid their enqueuement/garbage-collection).
- private transient ReferenceMap softReferenceCache = new ReferenceMap( ReferenceMap.SOFT, ReferenceMap.SOFT );
- // the MRU cache used to keep hard references to the most recently used query plans;
- // note : LRU here is a bit of a misnomer, it indicates that LRU entries are removed, the
- // actual kept entries are the MRU entries
- private transient LRUMap strongReferenceCache;
+ private final int strongRefCount;
+ private final int softRefCount;
+ private transient LRUMap strongRefCache;
+ private transient LRUMap softRefCache;
+ private transient ReferenceQueue referenceQueue;
+
+ /**
+ * Constructs a cache with the default settings.
+ *
+ * @see #DEFAULT_STRONG_REF_COUNT
+ * @see #DEFAULT_SOFT_REF_COUNT
+ */
public SoftLimitMRUCache() {
- this( DEFAULT_STRONG_REF_COUNT );
+ this( DEFAULT_STRONG_REF_COUNT, DEFAULT_SOFT_REF_COUNT );
}
- public SoftLimitMRUCache(int strongRefCount) {
- this.strongReferenceCount = strongRefCount;
+ /**
+ * Constructs a cache with the specified settings.
+ *
+ * @param strongRefCount the strong reference count.
+ * @param softRefCount the soft reference count.
+ *
+ * @throws IllegalArgumentException if either of the arguments is less than one, or if the strong
+ * reference count is higher than the soft reference count.
+ */
+ public SoftLimitMRUCache(int strongRefCount, int softRefCount) {
+ if ( strongRefCount < 1 || softRefCount < 1 ) {
+ throw new IllegalArgumentException( "Reference counts must be greater than zero" );
+ }
+ if ( strongRefCount > softRefCount ) {
+ throw new IllegalArgumentException( "Strong reference count cannot exceed soft reference count" );
+ }
+
+ this.strongRefCount = strongRefCount;
+ this.softRefCount = softRefCount;
init();
}
+ /**
+ * Gets an object from the cache.
+ *
+ * @param key the cache key.
+ *
+ * @return the stored value, or <code>null</code> if no entry exists.
+ */
public synchronized Object get(Object key) {
- Object result = softReferenceCache.get( key );
- if ( result != null ) {
- strongReferenceCache.put( key, result );
+ if ( key == null ) {
+ throw new NullPointerException( "Key to get cannot be null" );
}
- return result;
+
+ clearObsoleteReferences();
+
+ SoftReference ref = (SoftReference) softRefCache.get( key );
+ if ( ref != null ) {
+ Object refValue = ref.get();
+ if ( refValue != null ) {
+ // This ensures recently used entries are strongly-reachable
+ strongRefCache.put( key, refValue );
+ return refValue;
+ }
+ }
+
+ return null;
}
+ /**
+ * Puts a value in the cache.
+ *
+ * @param key the key.
+ * @param value the value.
+ *
+ * @return the previous value stored in the cache, if any.
+ */
public synchronized Object put(Object key, Object value) {
- softReferenceCache.put( key, value );
- return strongReferenceCache.put( key, value );
+ if ( key == null || value == null ) {
+ throw new NullPointerException(
+ getClass().getName() + "does not support null key [" + key + "] or value [" + value + "]"
+ );
+ }
+
+ clearObsoleteReferences();
+
+ strongRefCache.put( key, value );
+ SoftReference ref = (SoftReference) softRefCache.put(
+ key,
+ new KeyedSoftReference( key, value, referenceQueue )
+ );
+
+ return ( ref != null ) ? ref.get() : null;
}
+ /**
+ * Gets the strong reference cache size.
+ *
+ * @return the strong reference cache size.
+ */
public synchronized int size() {
- return strongReferenceCache.size();
+ clearObsoleteReferences();
+ return strongRefCache.size();
}
+ /**
+ * Gets the soft reference cache size.
+ *
+ * @return the soft reference cache size.
+ */
public synchronized int softSize() {
- return softReferenceCache.size();
+ clearObsoleteReferences();
+ return softRefCache.size();
}
+ /**
+ * Clears the cache.
+ */
+ public synchronized void clear() {
+ strongRefCache.clear();
+ softRefCache.clear();
+ }
+
private void init() {
- strongReferenceCache = new LRUMap( strongReferenceCount );
+ this.strongRefCache = new LRUMap( strongRefCount );
+ this.softRefCache = new LRUMap( softRefCount );
+ this.referenceQueue = new ReferenceQueue();
}
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
@@ -100,8 +206,26 @@
init();
}
- public synchronized void clear() {
- strongReferenceCache.clear();
- softReferenceCache.clear();
+ private void clearObsoleteReferences() {
+ // Clear entries for soft references removed by garbage collector
+ KeyedSoftReference obsoleteRef;
+ while ( ( obsoleteRef = (KeyedSoftReference) referenceQueue.poll() ) != null ) {
+ Object key = obsoleteRef.getKey();
+ softRefCache.remove( key );
+ }
}
+
+ private static class KeyedSoftReference extends SoftReference {
+ private final Object key;
+
+ @SuppressWarnings({ "unchecked" })
+ private KeyedSoftReference(Object key, Object value, ReferenceQueue q) {
+ super( value, q );
+ this.key = key;
+ }
+
+ private Object getKey() {
+ return key;
+ }
+ }
}
13 years, 9 months
Hibernate SVN: r20134 - in core/trunk/documentation/devguide/src/main/docbook/en-US: content and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-11 16:37:49 -0400 (Wed, 11 Aug 2010)
New Revision: 20134
Added:
core/trunk/documentation/devguide/src/main/docbook/en-US/content/database.xml
Modified:
core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml
Log:
HHH-5468 - Write a chapter about setting up database access
Modified: core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml
===================================================================
--- core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml 2010-08-11 19:18:05 UTC (rev 20133)
+++ core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml 2010-08-11 20:37:49 UTC (rev 20134)
@@ -10,5 +10,6 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/preface.xml" />
-->
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/database.xml" />
</book>
\ No newline at end of file
Added: core/trunk/documentation/devguide/src/main/docbook/en-US/content/database.xml
===================================================================
--- core/trunk/documentation/devguide/src/main/docbook/en-US/content/database.xml (rev 0)
+++ core/trunk/documentation/devguide/src/main/docbook/en-US/content/database.xml 2010-08-11 20:37:49 UTC (rev 20134)
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+<chapter id="hibernate-dev-database">
+ <title>Database Access</title>
+
+ <section id="hibernate-dev-database-connect">
+ <title>JDBC Connections</title>
+ <para>
+ Hibernate understands how to connect to a database through an interface
+ <interfacename>org.hibernate.connection.ConnectionProvider</interfacename>. While
+ <interfacename>org.hibernate.connection.ConnectionProvider</interfacename> is considered an extension SPI,
+ Hibernate comes with a number of built-in providers.
+ </para>
+
+ <section id="hibernate-dev-database-connect-pools">
+ <title>Using connection pooling</title>
+
+ <para>
+ The built-in connection pooling based providers all require the following settings
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><property>hibernate.connection.driver_class</property></term>
+ <listitem>
+ <para>
+ Names the <classname>java.sql.Driver</classname> implementation class from your JDBC
+ provider.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><property>hibernate.connection.url</property></term>
+ <listitem>
+ <para>
+ The JDBC connection url. See your JDBC provider's documentation for details and examples.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><property>hibernate.connection.username</property></term>
+ <listitem>
+ <para>
+ The name of the user to use when opening a JDBC <interfacename>java.sql.Connection</interfacename>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><property>hibernate.connection.password</property></term>
+ <listitem>
+ <para>
+ The password associated with the provided username.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <section id="hibernate-dev-database-connect-pools-hibernate">
+ <title>Using Hibernate's built-in connection pooling</title>
+
+ <caution>
+ <para>
+ The built-in Hibernate connection pool is not intended for production use. It lacks several
+ features found on any decent connection pool. However, it can be quite useful to get started
+ and in unit testing.
+ </para>
+ </caution>
+
+ <para>
+ The only additional supported setting for the built-in pooling is the
+ <property>hibernate.connection.pool_size</property> setting which tells the pool how many
+ connections maximum it can keep in the pool.
+ </para>
+ </section>
+
+ <section id="hibernate-dev-database-connect-pools-c3p0">
+ <title>Using c3p0 for connection pooling</title>
+ </section>
+
+ <section id="hibernate-dev-database-connect-pools-proxool">
+ <title>Using proxool for connection pooling</title>
+ </section>
+
+ </section>
+
+ <section id="hibernate-dev-database-connect-dataSource">
+ <title>Using <interfacename>javax.sql.DataSource</interfacename></title>
+ <!-- todo : centralized discussion of JNDI properties -->
+ <para>
+ Hibernate can also use a <interfacename>javax.sql.DataSource</interfacename> to obtain
+ connections. To do so, Hibernate expects to be able to locate the
+ <interfacename>javax.sql.DataSource</interfacename> in <literal>JNDI</literal>. The
+ <property>hibernate.connection.datasource</property> setting tells Hibernate the <literal>JNDI</literal>
+ namespace at which it can find the the <interfacename>javax.sql.DataSource</interfacename>.
+ </para>
+
+ <para>
+ Generally speaking a <interfacename>javax.sql.DataSource</interfacename> is configured to connect to
+ the database using a single set of credentials (username/password). Sometimes, however, the
+ <interfacename>javax.sql.DataSource</interfacename> is set up so that the credentials have to be
+ used to obtain a <interfacename>java.sql.Connection</interfacename> from it. In these cases
+ applications would specify the credentials via the <property>hibernate.connection.username</property>
+ and <property>hibernate.connection.password</property> settings, which Hibernate would pass along to the
+ <interfacename>javax.sql.DataSource</interfacename> when obtaining a
+ <interfacename>java.sql.Connection</interfacename> from it.
+ </para>
+ </section>
+
+ </section>
+
+ <section id="hibernate-dev-database-dialect">
+ <title>Database Dialects</title>
+ </section>
+
+ <section id="hiberate-dev-database-schema">
+ <title>Database Schema</title>
+ </section>
+
+</chapter>
\ No newline at end of file
13 years, 9 months
Hibernate SVN: r20133 - in core/trunk/documentation: devguide and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-11 15:18:05 -0400 (Wed, 11 Aug 2010)
New Revision: 20133
Added:
core/trunk/documentation/devguide/
core/trunk/documentation/devguide/pom.xml
core/trunk/documentation/devguide/src/
core/trunk/documentation/devguide/src/main/
core/trunk/documentation/devguide/src/main/docbook/
core/trunk/documentation/devguide/src/main/docbook/en-US/
core/trunk/documentation/devguide/src/main/docbook/en-US/Author_Group.xml
core/trunk/documentation/devguide/src/main/docbook/en-US/Book_Info.xml
core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.ent
core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml
core/trunk/documentation/devguide/src/main/docbook/en-US/content/
Modified:
core/trunk/documentation/pom.xml
Log:
HHH-5466 - Create "Developer Guide"
Property changes on: core/trunk/documentation/devguide
___________________________________________________________________
Name: svn:ignore
+ target
local
*.ipr
*.iws
*.iml
.classpath
.project
.settings
.nbattrs
*.log
*.properties
.clover
Added: core/trunk/documentation/devguide/pom.xml
===================================================================
--- core/trunk/documentation/devguide/pom.xml (rev 0)
+++ core/trunk/documentation/devguide/pom.xml 2010-08-11 19:18:05 UTC (rev 20133)
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-parent</artifactId>
+ <version>3.6.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>devguide</artifactId>
+ <packaging>jdocbook</packaging>
+
+ <properties>
+ <!-- Skip artifact deployment -->
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+
+ <executions>
+ <execution>
+ <!--
+ here we are attaching the translate goal so that the translations are processed
+ before compilation so that the translated XML is also transformed during
+ generation
+ -->
+ <phase>process-resources</phase>
+ <goals>
+ <goal>translate</goal>
+ </goals>
+ </execution>
+ </executions>
+
+ <configuration>
+ <sourceDocumentName>Hibernate_Getting_Started_Guide.xml</sourceDocumentName>
+ <masterTranslation>en-US</masterTranslation>
+ <translations>
+ <translation>de-DE</translation>
+ <translation>es-ES</translation>
+ <translation>fr-FR</translation>
+ <translation>ja-JP</translation>
+ <!-- <translation>ko-KR</translation> -->
+ <translation>pt-BR</translation>
+ <translation>zh-CN</translation>
+ </translations>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en-US</directory>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>**/*.xml</exclude>
+ <exclude>*.zargo</exclude>
+ <exclude>**/*.zargo</exclude>
+ </excludes>
+ </imageResource>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Copied: core/trunk/documentation/devguide/src/main/docbook/en-US/Author_Group.xml (from rev 20114, core/trunk/documentation/manual/src/main/docbook/en-US/author_group.xml)
===================================================================
--- core/trunk/documentation/devguide/src/main/docbook/en-US/Author_Group.xml (rev 0)
+++ core/trunk/documentation/devguide/src/main/docbook/en-US/Author_Group.xml 2010-08-11 19:18:05 UTC (rev 20133)
@@ -0,0 +1,193 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+<authorgroup>
+ <author>
+ <firstname>Gavin</firstname>
+ <surname>King</surname>
+ </author>
+ <author>
+ <firstname>Christian</firstname>
+ <surname>Bauer</surname>
+ </author>
+ <author>
+ <firstname>Max</firstname>
+ <othername>Rydahl</othername>
+ <surname>Andersen</surname>
+ </author>
+ <author>
+ <firstname>Emmanuel</firstname>
+ <surname>Bernard</surname>
+ </author>
+ <author>
+ <firstname>Steve</firstname>
+ <surname>Ebersole</surname>
+ </author>
+ <author>
+ <firstname>Hardy</firstname>
+ <surname>Ferentschik</surname>
+ </author>
+
+ <othercredit>
+ <firstname>James</firstname>
+ <surname>Cobb</surname>
+ <affiliation>
+ <shortaffil>Graphic Design</shortaffil>
+ </affiliation>
+ </othercredit>
+ <othercredit>
+ <firstname>Cheyenne</firstname>
+ <surname>Weaver</surname>
+ <affiliation>
+ <shortaffil>Graphic Design</shortaffil>
+ </affiliation>
+ </othercredit>
+
+ <!--
+ #######################################################################
+ # Spanish
+ #######################################################################
+ -->
+ <othercredit class="translator" lang="es-ES">
+ <othername><![CDATA[Bernardo Antonio Buffa Colomé]]></othername>
+ <email>kreimer(a)bbs.frc.utn.edu.ar</email>
+ </othercredit>
+
+ <!--
+ #######################################################################
+ # French
+ #######################################################################
+ -->
+ <othercredit class="translator" lang="fr-FR">
+ <firstname>Vincent</firstname>
+ <surname>Ricard</surname>
+ </othercredit>
+ <othercredit class="translator" lang="fr-FR">
+ <firstname>Sebastien</firstname>
+ <surname>Cesbron</surname>
+ </othercredit>
+ <othercredit class="translator" lang="fr-FR">
+ <firstname>Michael</firstname>
+ <surname>Courcy</surname>
+ </othercredit>
+ <othercredit class="translator" lang="fr-FR">
+ <firstname>Vincent</firstname>
+ <surname>Giguère</surname>
+ </othercredit>
+ <othercredit class="translator" lang="fr-FR">
+ <firstname>Baptiste</firstname>
+ <surname>Mathus</surname>
+ </othercredit>
+ <othercredit class="translator" lang="fr-FR">
+ <firstname>Emmanuel</firstname>
+ <surname>Bernard</surname>
+ </othercredit>
+ <othercredit class="translator" lang="fr-FR">
+ <firstname>Anthony</firstname>
+ <surname>Patricio</surname>
+ </othercredit>
+
+ <!--
+ #######################################################################
+ # Portugese
+ #######################################################################
+ -->
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Alvaro</firstname>
+ <surname>Netto</surname>
+ <email>alvaronetto(a)cetip.com.br</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Anderson</firstname>
+ <surname>Braulio</surname>
+ <email>andersonbraulio(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Daniel Vieira</firstname>
+ <surname>Costa</surname>
+ <email>danielvc(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Francisco</firstname>
+ <surname>gamarra</surname>
+ <email>francisco.gamarra(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Gamarra</firstname>
+ <email>mauricio.gamarra(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Luiz Carlos</firstname>
+ <surname>Rodrigues</surname>
+ <email>luizcarlos_rodrigues(a)yahoo.com.br</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Marcel</firstname>
+ <surname>Castelo</surname>
+ <email>marcel.castelo(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Paulo</firstname>
+ <surname>César</surname>
+ <email>paulocol(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Pablo L.</firstname>
+ <surname>de Miranda</surname>
+ <email>pablolmiranda(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Renato</firstname>
+ <surname>Deggau</surname>
+ <email>rdeggau(a)gmail.com</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Rogério</firstname>
+ <surname>Araújo</surname>
+ <email>rgildoaraujo(a)yahoo.com.br</email>
+ </othercredit>
+ <othercredit class="translator" lang="pt-BR">
+ <firstname>Wanderson</firstname>
+ <surname>Siqueira</surname>
+ <email>wandersonxs(a)gmail.com</email>
+ </othercredit>
+
+ <!--
+ #######################################################################
+ # Chinese
+ #######################################################################
+ -->
+ <othercredit class="translator" lang="zh-CN">
+ <firstname>Cao</firstname>
+ <surname>Xiaogang</surname>
+ <affiliation>
+ <orgname>RedSaga</orgname>
+ </affiliation>
+ <contrib>Translation Lead</contrib>
+ <email>caoxg(a)yahoo.com</email>
+ </othercredit>
+
+</authorgroup>
Copied: core/trunk/documentation/devguide/src/main/docbook/en-US/Book_Info.xml (from rev 20131, core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml)
===================================================================
--- core/trunk/documentation/devguide/src/main/docbook/en-US/Book_Info.xml (rev 0)
+++ core/trunk/documentation/devguide/src/main/docbook/en-US/Book_Info.xml 2010-08-11 19:18:05 UTC (rev 20133)
@@ -0,0 +1,54 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Developer_Guide.ent">
+%BOOK_ENTITIES;
+]>
+
+<bookinfo id="Hibernate_Developer_Guide">
+ <title>Hibernate Developer Guide</title>
+ <releaseinfo>&version;</releaseinfo>
+ <edition>1.0</edition>
+ <pubsnumber>1</pubsnumber>
+ <productname>JBoss Hibernate Core</productname>
+ <productnumber>&version;</productnumber>
+ <pubdate>&today;</pubdate>
+ <issuenum>1</issuenum>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/hibernate_logo_a.png" align="center" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
+ </imageobject>
+ </mediaobject>
+ <copyright>
+ <year>©rightYear;</year>
+ <holder>©rightHolder;</holder>
+ </copyright>
+
+ <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+</bookinfo>
Added: core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.ent
===================================================================
--- core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.ent (rev 0)
+++ core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.ent 2010-08-11 19:18:05 UTC (rev 20133)
@@ -0,0 +1,5 @@
+<!ENTITY version "WORKING">
+<!ENTITY today "TODAY">
+<!ENTITY copyrightYear "2004">
+<!ENTITY copyrightHolder "Red Hat, Inc.">
+<!ENTITY semi ";">
Added: core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml
===================================================================
--- core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml (rev 0)
+++ core/trunk/documentation/devguide/src/main/docbook/en-US/Hibernate_Developer_Guide.xml 2010-08-11 19:18:05 UTC (rev 20133)
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Developer_Guide.ent">
+ %BOOK_ENTITIES;
+]>
+
+<book>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Book_Info.xml" />
+ <!-- todo : preface once solidified in getting started guide...
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/preface.xml" />
+ -->
+
+
+</book>
\ No newline at end of file
Modified: core/trunk/documentation/pom.xml
===================================================================
--- core/trunk/documentation/pom.xml 2010-08-11 16:06:22 UTC (rev 20132)
+++ core/trunk/documentation/pom.xml 2010-08-11 19:18:05 UTC (rev 20133)
@@ -26,6 +26,7 @@
<module>manual</module>
<module>envers</module>
<module>quickstart</module>
+ <module>devguide</module>
<!--
<module>jbosscache2</module>
-->
13 years, 9 months
Hibernate SVN: r20132 - core/trunk/documentation/quickstart/src/main/docbook/en-US/content.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-11 12:06:22 -0400 (Wed, 11 Aug 2010)
New Revision: 20132
Modified:
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
Log:
HHH-5442 - Create a "quick start" guide
Modified: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-10 20:57:50 UTC (rev 20131)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-11 16:06:22 UTC (rev 20132)
@@ -84,7 +84,7 @@
</step>
<step id="hibernate-gsg-tutorial-native-entity">
- <title>Write the entity Java class</title>
+ <title>Create the entity Java class</title>
<para>
Create a file named <filename>src/main/java/org/hibernate/tutorial/native/Event.java</filename>
@@ -156,7 +156,7 @@
</step>
<step id="hibernate-gsg-tutorial-native-mapping">
- <title>Write the entity mapping file</title>
+ <title>Create the entity mapping file</title>
<para>
Create a file named <filename>src/main/resources/org/hibernate/tutorial/native/Event.hbm.xml</filename>
@@ -263,7 +263,7 @@
</step>
<step id="hibernate-gsg-tutorial-native-config">
- <title>Create a Hibernate configuration file</title>
+ <title>Create the Hibernate configuration file</title>
<para>
Create a file named <filename>src/main/resources/hibernate.cfg.xml</filename>
13 years, 9 months
Hibernate SVN: r20131 - in core/trunk/documentation: quickstart and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-08-10 16:57:50 -0400 (Tue, 10 Aug 2010)
New Revision: 20131
Added:
core/trunk/documentation/quickstart/src/main/docbook/en-US/Author_Group.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.ent
core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/community.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/obtaining.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/preface.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml
core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
Removed:
core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.ent
core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.xml
Modified:
core/trunk/documentation/manual/src/main/docbook/en-US/content/preface.xml
core/trunk/documentation/quickstart/pom.xml
Log:
HHH-5442 - Create a "quick start" guide
Modified: core/trunk/documentation/manual/src/main/docbook/en-US/content/preface.xml
===================================================================
--- core/trunk/documentation/manual/src/main/docbook/en-US/content/preface.xml 2010-08-09 19:56:25 UTC (rev 20130)
+++ core/trunk/documentation/manual/src/main/docbook/en-US/content/preface.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -23,7 +23,7 @@
~ Boston, MA 02110-1301 USA
-->
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
%BOOK_ENTITIES;
@@ -36,10 +36,9 @@
Working with both Object-Oriented software and Relational Databases can be cumbersome and time consuming.
Development costs are significantly higher due to a paradigm mismatch between how data is represented in
objects versus relational databases. Hibernate is an Object/Relational Mapping solution for Java environments.
- The term Object/Relational Mapping refers to the technique of mapping a data representation from an object model
- to a relational data model with a SQL-based schema;
- see <ulink url="http://en.wikipedia.org/wiki/Object-relational_mapping">http://en.wikipedia.org/wiki/Object-relational_mapping</ulink>
- for a discussion.
+ The term Object/Relational Mapping refers to the technique of mapping data from an object model representation
+ to a relational data model representation (and visa versa). See <ulink url="http://en.wikipedia.org/wiki/Object-relational_mapping"/>
+ for a good high-level discussion.
</para>
<note>
@@ -65,27 +64,23 @@
<para>
Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to
- SQL data types), but also provides data query and retrieval facilities. It can also significantly reduce
- development time otherwise spent with manual data handling in SQL and JDBC.
+ SQL data types), but also provides data query and retrieval facilities. It can significantly reduce
+ development time otherwise spent with manual data handling in SQL and JDBC. Hibernate’s design goal is to
+ relieve the developer from 95% of common data persistence-related programming tasks by eliminating the need for
+ manual, hand-crafted data processing using SQL and JDBC. However, unlike many other persistence solutions,
+ Hibernate does not hide the power of SQL from you and guarantees that your investment in relational technology
+ and knowledge is as valid as always.
</para>
<para>
- Hibernate’s design goal is to relieve the developer from 95% of common data persistence-related programming
- tasks by eliminating the need for manual, hand-crafted data processing using SQL and JDBC. However, unlike
- many other persistence solutions, Hibernate does not hide the power of SQL from you and guarantees that your
- investment in relational technology and knowledge is as valid as always.
+ Hibernate may not be the best solution for data-centric applications that only use stored-procedures to
+ implement the business logic in the database, it is most useful with object-oriented domain models and business
+ logic in the Java-based middle-tier. However, Hibernate can certainly help you to remove or encapsulate
+ vendor-specific SQL code and will help with the common task of result set translation from a tabular
+ representation to a graph of objects.
</para>
<para>
- Hibernate may not be the best solution for data-centric
- applications that only use stored-procedures to implement the business logic in the
- database, it is most useful with object-oriented domain models and business logic in
- the Java-based middle-tier. However, Hibernate can certainly help you to remove or
- encapsulate vendor-specific SQL code and will help with the common task of result set
- translation from a tabular representation to a graph of objects.
- </para>
-
- <para>
If you are new to Hibernate and Object/Relational Mapping or even Java,
please follow these steps:
</para>
Modified: core/trunk/documentation/quickstart/pom.xml
===================================================================
--- core/trunk/documentation/quickstart/pom.xml 2010-08-09 19:56:25 UTC (rev 20130)
+++ core/trunk/documentation/quickstart/pom.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -67,7 +67,7 @@
</executions>
<configuration>
- <sourceDocumentName>Hibernate_QuickStart_Guide.xml</sourceDocumentName>
+ <sourceDocumentName>Hibernate_Getting_Started_Guide.xml</sourceDocumentName>
<masterTranslation>en-US</masterTranslation>
<translations>
<translation>de-DE</translation>
Added: core/trunk/documentation/quickstart/src/main/docbook/en-US/Author_Group.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Author_Group.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Author_Group.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,42 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Getting_Started_Guide.ent">
+%BOOK_ENTITIES;
+]>
+
+<authorgroup>
+
+ <author>
+ <firstname>Gavin</firstname>
+ <surname>King</surname>
+ </author>
+ <author>
+ <firstname>Christian</firstname>
+ <surname>Bauer</surname>
+ </author>
+ <author>
+ <firstname>Emmanuel</firstname>
+ <surname>Bernard</surname>
+ </author>
+ <author>
+ <firstname>Steve</firstname>
+ <surname>Ebersole</surname>
+ </author>
+
+ <othercredit>
+ <firstname>James</firstname>
+ <surname>Cobb</surname>
+ <affiliation>
+ <shortaffil>Graphic Design</shortaffil>
+ </affiliation>
+ </othercredit>
+
+ <othercredit>
+ <firstname>Cheyenne</firstname>
+ <surname>Weaver</surname>
+ <affiliation>
+ <shortaffil>Graphic Design</shortaffil>
+ </affiliation>
+ </othercredit>
+
+</authorgroup>
\ No newline at end of file
Added: core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Book_Info.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,31 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Getting_Started_Guide.ent">
+%BOOK_ENTITIES;
+]>
+
+<bookinfo id="Hibernate_Getting_Started_Guide">
+ <title>Hibernate Getting Started Guide</title>
+ <releaseinfo>&version;</releaseinfo>
+ <edition>1.0</edition>
+ <pubsnumber>1</pubsnumber>
+ <productname>JBoss Hibernate Core</productname>
+ <productnumber>&version;</productnumber>
+ <pubdate>&today;</pubdate>
+ <issuenum>1</issuenum>
+ <mediaobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/hibernate_logo_a.png" align="center" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
+ </imageobject>
+ </mediaobject>
+ <copyright>
+ <year>©rightYear;</year>
+ <holder>©rightHolder;</holder>
+ </copyright>
+
+ <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+</bookinfo>
Copied: core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.ent (from rev 20118, core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.ent)
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.ent (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.ent 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,5 @@
+<!ENTITY version "WORKING">
+<!ENTITY today "TODAY">
+<!ENTITY copyrightYear "2004">
+<!ENTITY copyrightHolder "Red Hat, Inc.">
+<!ENTITY semi ";">
Copied: core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml (from rev 20118, core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.xml)
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_Getting_Started_Guide.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Getting_Started_Guide.ent">
+ %BOOK_ENTITIES;
+]>
+
+<book>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Book_Info.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/preface.xml" />
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/community.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/obtaining.xml" />
+
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_native.xml" />
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/tutorial_annotations.xml" />
+
+
+</book>
\ No newline at end of file
Deleted: core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.ent
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.ent 2010-08-09 19:56:25 UTC (rev 20130)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.ent 2010-08-10 20:57:50 UTC (rev 20131)
@@ -1,5 +0,0 @@
-<!ENTITY version "WORKING">
-<!ENTITY today "TODAY">
-<!ENTITY copyrightYear "2004">
-<!ENTITY copyrightHolder "Red Hat, Inc.">
-<!ENTITY semi ";">
Deleted: core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.xml 2010-08-09 19:56:25 UTC (rev 20130)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/Hibernate_QuickStart_Guide.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -1,253 +0,0 @@
-<?xml version='1.0' encoding='UTF-8' ?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_QuickStart_Guide.ent">
- %BOOK_ENTITIES;
-]>
-
-<book>
- <bookinfo id="Hibernate_QuickStart_Guide">
- <title>Hibernate QuickStart Guide</title>
- <releaseinfo>&version;</releaseinfo>
- <edition>1.0</edition>
- <pubsnumber>1</pubsnumber>
- <productname>JBoss Hibernate Core</productname>
- <productnumber>&version;</productnumber>
- <pubdate>&today;</pubdate>
- <issuenum>1</issuenum>
- <mediaobject>
- <imageobject role="fo">
- <imagedata fileref="images/hibernate_logo_a.png" align="center" />
- </imageobject>
- <imageobject role="html">
- <imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
- </imageobject>
- </mediaobject>
- <copyright>
- <year>©rightYear;</year>
- <holder>©rightHolder;</holder>
- </copyright>
- </bookinfo>
-
- <!-- todo : preface -->
-
- <chapter id="hibernate-qs-setup">
- <title>Obtaining Hibernate</title>
-
- <para>
- There are 2 very different ways to "obtain" Hibernate...
- </para>
-
- <section id="hibernate-qs-setup-releaseBundle">
- <title>Release Bundle Downloads</title>
- <para>
- The Hibernate team provides release bundles hosted on the SourceForge File Release System, which contain
- jars, documentation, source code, etc. To obtain the release bundles go to
- <ulink url="http://sourceforge.net/projects/hibernate/files/hibernate3/">http://sourceforge.net/projects/hibernate/files/hibernate3/</ulink>,
- navigate to the release in which you are interested and select whichever format you prefer.
- </para>
- <itemizedlist>
- <listitem>
- <para>
- <filename>hibernate3.jar</filename> is an aggregation of all the Hibernate Core classes.
- This would need to be part of your project classpath.
- </para>
- </listitem>
- <listitem>
- <para>
- The <filename>lib/required</filename> directory contains jars that are
- <emphasis>required</emphasis> for Hibernate to run. All the jars in this directory would need
- to be part of your project classpath as well.
- </para>
- <important>
- <para>
- The slf4j jar is special in that you still need further jar file(s) for it to work correctly.
- Which jar(s) depends on which logging back-end you want to use. See the
- <ulink url="http://slf4j.org/">slf4j site</ulink> for details.
- </para>
- </important>
- </listitem>
- <listitem>
- <para>
- The <filename>/lib/jpa</filename> directory contains the
- <ulink url="http://jcp.org/en/jsr/detail?id=317">JPA</ulink> API jar. If you want to use the
- JPA APIs or JPA annotations, this jar will need to be part of your project classpath too.
- </para>
- </listitem>
- <listitem>
- <para>
- The <filename>/lib/optional</filename> directory contains jar files needed when utilizing various
- (optional) integrations with Hibernate. These are beyond the scope of this guide, but are
- mentioned for completeness. If you were to use any of these features the appropriate jars from here
- would need to also be part of your project's classpath (though generally speaking these are only needed
- for runtime, not compile-time).
- </para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section id="hibernate-qs-setup-mavenRepoArtifacts">
- <title>Maven Repository Artifacts</title>
- <important>
- <para>
- The authoritative repository for Hibernate artifacts is the JBoss
- Maven repository. The team responsible for the JBoss Maven repository maintains a number of wiki
- pages that contain important information:
- <itemizedlist>
- <listitem>
- <para>
- <ulink url="http://community.jboss.org/docs/DOC-14900">http://community.jboss.org/docs/DOC-14900</ulink> -
- contains general information about the repository
- </para>
- </listitem>
- <listitem>
- <para>
- <ulink url="http://community.jboss.org/docs/DOC-15170">http://community.jboss.org/docs/DOC-15170</ulink> -
- contains information about setting up access to the repository for <emphasis>developers</emphasis>
- (aka, developers working on Hibernate or JBoss projects).
- </para>
- </listitem>
- <listitem>
- <para>
- <ulink url="http://community.jboss.org/docs/DOC-15169">http://community.jboss.org/docs/DOC-15169</ulink> -
- contains information about setting up access to the repository for <emphasis>users</emphasis>
- (aka, consumers of Hibernate or JBoss projects).
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </important>
- <para>
- Hibernate produces a number of artifacts (all under the org.hibernate groupId):
- <itemizedlist>
- <listitem>
- <para>
- <emphasis>hibernate-core</emphasis> - This is the main artifact. It contains all the
- Hibernate classes (<package>org.hibernate</package>) needed to build applications using
- the native Hibernate APIs. It includes capabilities for using native Hibernate mapping
- (<filename>hbm.xml</filename>) files as well as annotations.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-entitymanager</emphasis> - Hibernate provides an implementation of
- <ulink url="http://jcp.org/en/jsr/detail?id=317">JPA</ulink>. This is the artifact that
- represents this JPA implementation.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-envers</emphasis> - Envers is an optional module that
- provides historical auditing of changes to your entities.
- </para>
- <para>
- This artifact depends on both <emphasis>hibernate-core</emphasis> and
- <emphasis>hibernate-entitymanager</emphasis>.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-c3p0</emphasis> - Represents the integration between Hibernate
- and the <ulink url="http://sourceforge.net/projects/c3p0/">C3P0</ulink> connection pool
- library.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
- be included in a project as a runtime dependency (rarely would you need to bind against
- these classes at compile time). It also pulls in the C3P0 dependencies.
- be
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-proxool</emphasis> - Represents the integration between Hibernate
- and the <ulink url="http://proxool.sourceforge.net/">Proxool</ulink> connection pool
- library.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
- be included in a project as a runtime dependency (rarely would you need to bind against
- these classes at compile time). It also pulls in the Proxool dependencies.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-ehcache</emphasis> - Represents the integration between Hibernate
- and <ulink url="http://ehcache.sourceforge.net/">EhCache</ulink> as a second level cache
- implementation.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
- be included in a project as a runtime dependency (rarely would you need to bind against
- these classes at compile time). It also pulls in the Ehcache dependencies.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-infinispan</emphasis> - Represents the integration between Hibernate
- and <ulink url="http://jboss.org/infinispan">Infinispan</ulink> as a second level cache
- implementation.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
- be included in a project as a runtime dependency (rarely would you need to bind against
- these classes at compile time). It also pulls in the Infinispan dependencies.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-jbosscache</emphasis> - Represents the integration between Hibernate
- and <ulink url="http://jboss.org/jbosscache">JBossCache</ulink> as a second level cache
- implementation.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
- be included in a project as a runtime dependency (rarely would you need to bind against
- these classes at compile time). It also pulls in the JBossCache dependencies
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-oscache</emphasis> - Represents the integration between Hibernate
- and <ulink url="http://www.opensymphony.com/oscache/">OSCache</ulink> as a second level cache
- implementation.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
- be included in a project as a runtime dependency (rarely would you need to bind against
- these classes at compile time). It also pulls in the OSCache dependencies.
- </para>
- </listitem>
- <listitem>
- <para>
- <emphasis>hibernate-swarmcache</emphasis> - Represents the integration between Hibernate
- and <ulink url="http://swarmcache.sourceforge.net/">SwarmCache</ulink> as a second level cache
- implementation.
- </para>
- <para>
- This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
- be included in a project as a runtime dependency (rarely would you need to bind against
- these classes at compile time). It also pulls in the SwarmCache dependencies.
- </para>
- </listitem>
- </itemizedlist>
- </para>
- </section>
- </chapter>
-
- <chapter id="hibernate-qs-keyConcepts">
- <title>Key Concepts</title>
- <para>
- Discuss some key concepts such as Configuration, SessionFactory, Session (?and Transaction?).
- </para>
- </chapter>
-
- <chapter id="hibernate-qs-nextSteps">
- <title>Next Steps</title>
- <para>
- go on to tutorials; community links
- </para>
- </chapter>
-</book>
\ No newline at end of file
Added: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/community.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/community.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/community.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,42 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+<chapter id="hibernate-gsg-community">
+ <title>Hibernate Community</title>
+
+ <para>
+ There are a number of ways to become involved in the Hibernate community, including
+ <itemizedlist>
+ <listitem>
+ <para>
+ Trying stuff out and reporting bugs. See <ulink url="http://hibernate.org/issuetracker.html"/> for
+ details.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Trying your hand at fixing some bugs or implementing enhancements. Again, see
+ <ulink url="http://hibernate.org/issuetracker.html"/>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="http://hibernate.org/community.html"/> lists a number of ways to engage in the community
+ including mailing lists, forums, IRC and others.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Helping improve or translate this documentation. Contact us on the developer mailing list
+ if you have interest.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Evangelizing Hibernate within your organization.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+</chapter>
Added: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/obtaining.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/obtaining.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/obtaining.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,204 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+
+<chapter id="hibernate-gsg-obtain">
+ <title>Obtaining Hibernate</title>
+
+ <para>
+ You obtain Hibernate in one of two anticipated ways.
+ </para>
+
+ <section id="hibernate-gsg-setup-releaseBundle">
+ <title>Release Bundle Downloads</title>
+ <para>
+ The Hibernate team provides release bundles hosted on the SourceForge File Release System, both in
+ <literal>ZIP</literal> and <literal>TGZ</literal> formats. A release bundle contains <literal>JARs</literal>,
+ documentation, source code, and other information.
+ </para>
+ <para>
+ Navigate to <ulink url="http://sourceforge.net/projects/hibernate/files/hibernate3/"/> and download the
+ desired release from the list, in your format of choice.
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <filename>hibernate3.jar</filename> is an aggregation of all the Hibernate Core classes.
+ This would need to be part of your project classpath.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <filename>lib/required</filename> directory contains jars that are
+ <emphasis>required</emphasis> for Hibernate to run. All the jars in this directory would need
+ to be part of your project classpath as well.
+ </para>
+ <important>
+ <para>
+ The slf4j jar is special in that you still need further jar file(s) for it to work correctly.
+ Which jar(s) depends on which logging back-end you want to use. See the
+ <ulink url="http://slf4j.org/">slf4j site</ulink> for details.
+ </para>
+ </important>
+ </listitem>
+ <listitem>
+ <para>
+ The <filename>/lib/jpa</filename> directory contains the
+ <ulink url="http://jcp.org/en/jsr/detail?id=317">JPA</ulink> API jar. If you want to use the
+ JPA APIs or JPA annotations, this jar will need to be part of your project classpath too.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section id="hibernate-gsg-setup-mavenRepoArtifacts">
+ <title>Maven Repository Artifacts</title>
+ <important>
+ <para>
+ The authoritative repository for Hibernate artifacts is the JBoss
+ Maven repository. The team responsible for the JBoss Maven repository maintains a number of wiki
+ pages that contain important information:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <ulink url="http://community.jboss.org/docs/DOC-14900">http://community.jboss.org/docs/DOC-14900</ulink> -
+ contains general information about the repository
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="http://community.jboss.org/docs/DOC-15170">http://community.jboss.org/docs/DOC-15170</ulink> -
+ contains information about setting up access to the repository for <emphasis>developers</emphasis>
+ (aka, developers working on Hibernate or JBoss projects).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="http://community.jboss.org/docs/DOC-15169">http://community.jboss.org/docs/DOC-15169</ulink> -
+ contains information about setting up access to the repository for <emphasis>users</emphasis>
+ (aka, consumers of Hibernate or JBoss projects).
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </important>
+ <para>
+ Hibernate produces a number of artifacts (all under the org.hibernate groupId):
+ <itemizedlist>
+ <listitem>
+ <para>
+ <emphasis>hibernate-core</emphasis> - This is the main artifact. It contains all the
+ Hibernate classes (<package>org.hibernate</package>) needed to build applications using
+ the native Hibernate APIs. It includes capabilities for using native Hibernate mapping
+ (<filename>hbm.xml</filename>) files as well as annotations.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-entitymanager</emphasis> - Hibernate provides an implementation of
+ <ulink url="http://jcp.org/en/jsr/detail?id=317">JPA</ulink>. This is the artifact that
+ represents this JPA implementation.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-envers</emphasis> - Envers is an optional module that
+ provides historical auditing of changes to your entities.
+ </para>
+ <para>
+ This artifact depends on both <emphasis>hibernate-core</emphasis> and
+ <emphasis>hibernate-entitymanager</emphasis>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-c3p0</emphasis> - Represents the integration between Hibernate
+ and the <ulink url="http://sourceforge.net/projects/c3p0/">C3P0</ulink> connection pool
+ library.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
+ be included in a project as a runtime dependency (rarely would you need to bind against
+ these classes at compile time). It also pulls in the C3P0 dependencies.
+ be
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-proxool</emphasis> - Represents the integration between Hibernate
+ and the <ulink url="http://proxool.sourceforge.net/">Proxool</ulink> connection pool
+ library.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
+ be included in a project as a runtime dependency (rarely would you need to bind against
+ these classes at compile time). It also pulls in the Proxool dependencies.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-ehcache</emphasis> - Represents the integration between Hibernate
+ and <ulink url="http://ehcache.sourceforge.net/">EhCache</ulink> as a second level cache
+ implementation.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
+ be included in a project as a runtime dependency (rarely would you need to bind against
+ these classes at compile time). It also pulls in the Ehcache dependencies.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-infinispan</emphasis> - Represents the integration between Hibernate
+ and <ulink url="http://jboss.org/infinispan">Infinispan</ulink> as a second level cache
+ implementation.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
+ be included in a project as a runtime dependency (rarely would you need to bind against
+ these classes at compile time). It also pulls in the Infinispan dependencies.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-jbosscache</emphasis> - Represents the integration between Hibernate
+ and <ulink url="http://jboss.org/jbosscache">JBossCache</ulink> as a second level cache
+ implementation.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
+ be included in a project as a runtime dependency (rarely would you need to bind against
+ these classes at compile time). It also pulls in the JBossCache dependencies
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-oscache</emphasis> - Represents the integration between Hibernate
+ and <ulink url="http://www.opensymphony.com/oscache/">OSCache</ulink> as a second level cache
+ implementation.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
+ be included in a project as a runtime dependency (rarely would you need to bind against
+ these classes at compile time). It also pulls in the OSCache dependencies.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <emphasis>hibernate-swarmcache</emphasis> - Represents the integration between Hibernate
+ and <ulink url="http://swarmcache.sourceforge.net/">SwarmCache</ulink> as a second level cache
+ implementation.
+ </para>
+ <para>
+ This artifact depends on <emphasis>hibernate-core</emphasis>; however it would generally
+ be included in a project as a runtime dependency (rarely would you need to bind against
+ these classes at compile time). It also pulls in the SwarmCache dependencies.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </section>
+</chapter>
\ No newline at end of file
Added: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/preface.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/preface.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/preface.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,88 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Inc.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "../Hibernate_Getting_Started_Guide.ent">
+%BOOK_ENTITIES;
+
+]>
+
+<preface id="hibernate-gsg-preface">
+ <title>Preface</title>
+
+ <!--
+ NOTE : This duplicates a lot of the information in the manual preface. This is a great example of where the
+ "content reuse" capabilities of DITA could be leveraged.
+ -->
+
+ <para>
+ Working with both Object-Oriented software and Relational Databases can be cumbersome and time consuming.
+ Development costs are significantly higher due to a paradigm mismatch between how data is represented in
+ objects versus relational databases. Hibernate is an Object/Relational Mapping solution for Java environments.
+ The term Object/Relational Mapping refers to the technique of mapping data from an object model representation
+ to a relational data model representation (and visa versa). See
+ <ulink url="http://en.wikipedia.org/wiki/Object-relational_mapping"/> for a good high-level discussion.
+ </para>
+
+ <note>
+ <para>
+ While having a strong background in SQL is not required to use Hibernate, having a basic understanding of
+ the concepts can greatly help you understand Hibernate more fully and quickly. Probably the single
+ best background is an understanding of data modeling principles. You might want to consider these resources
+ as a good starting point:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <ulink url="http://www.agiledata.org/essays/dataModeling101.html"/>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="http://en.wikipedia.org/wiki/Data_modeling"/>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </note>
+
+ <para>
+ Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to
+ SQL data types), but also provides data query and retrieval facilities. It can significantly reduce
+ development time otherwise spent with manual data handling in SQL and JDBC. Hibernate’s design goal is to
+ relieve the developer from 95% of common data persistence-related programming tasks by eliminating the need for
+ manual, hand-crafted data processing using SQL and JDBC. However, unlike many other persistence solutions,
+ Hibernate does not hide the power of SQL from you and guarantees that your investment in relational technology
+ and knowledge is as valid as always.
+ </para>
+
+ <para>
+ Hibernate may not be the best solution for data-centric applications that only use stored-procedures to
+ implement the business logic in the database, it is most useful with object-oriented domain models and business
+ logic in the Java-based middle-tier. However, Hibernate can certainly help you to remove or encapsulate
+ vendor-specific SQL code and will help with the common task of result set translation from a tabular
+ representation to a graph of objects.
+ </para>
+
+</preface>
Added: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_annotations.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,17 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+<chapter id="hibernate-gsg-tutorial-annotations">
+ <title>Tutorial Using Native Hibernate APIs and annotations</title>
+
+ <para>
+ This tutorial introduces some key concepts of the native Hibernate API.
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+
+ </para>
+ </listitem>
+ </itemizedlist>
+</chapter>
\ No newline at end of file
Added: core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml
===================================================================
--- core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml (rev 0)
+++ core/trunk/documentation/quickstart/src/main/docbook/en-US/content/tutorial_native.xml 2010-08-10 20:57:50 UTC (rev 20131)
@@ -0,0 +1,519 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
+<chapter id="hibernate-gsg-tutorial-native">
+ <title>Tutorial Using Native Hibernate APIs and <filename>hbm.xml</filename> mappings</title>
+
+ <note>
+ <para>
+ This tutorial will use the "standard layout" advocated by many build tools and best practices.
+ <ulink url="http://maven.apache.org/guides/introduction/introduction-to-the-standard-..."/>
+ provides a good description of the "standard layout" if you are unfamiliar.
+ </para>
+ </note>
+
+ <tip>
+ <para>
+ The tutorials in this guide utilize Maven, taking advantage of its transitive dependency management
+ capabilities as well as the ability of many IDEs to automatically set up a project based on the Maven
+ descriptor. Just be aware that it is not a requirement to use Maven as your build tool in order to use
+ Hibernate.
+ </para>
+ </tip>
+
+ <procedure>
+ <title>Steps</title>
+
+ <step id="hibernate-gsg-tutorial-native-pom">
+ <title>Create the Maven POM file</title>
+ <para>
+ Create a file named <filename>pom.xml</filename> in the root of your project directory with the
+ following contents
+ </para>
+ <example id="hibernate-gsg-tutorial-native-pom-ex1">
+ <title><filename>pom.xml</filename></title>
+ <programlisting role="XML"><![CDATA[<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.hibernate.tutorials</groupId>
+ <artifactId>hibernate-tutorial-native</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <name>Hibernate Native Tutorial</name>
+
+ <build>
+ <!-- we dont want the version to be part of the generated war file name -->
+ <finalName>${artifactId}</finalName>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+
+ <!-- Because this is a web app, we also have a dependency on the servlet api. -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <!-- Hibernate uses slf4j for logging, for our purposes here use the simple backend -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
+
+ <!-- Hibernate gives you a choice of bytecode providers between cglib and javassist -->
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </dependency>
+
+ <!-- The tutorial uses the H2 in-memory database -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>]]></programlisting>
+ </example>
+ </step>
+
+ <step id="hibernate-gsg-tutorial-native-entity">
+ <title>Write the entity Java class</title>
+
+ <para>
+ Create a file named <filename>src/main/java/org/hibernate/tutorial/native/Event.java</filename>
+ with the following contents:
+ </para>
+
+ <example id="hibernate-gsg-tutorial-native-entity-ex1">
+ <title><filename>Entity.java</filename></title>
+ <programlisting role="JAVA"><![CDATA[package org.hibernate.tutorial.native;
+
+ import java.util.Date;
+
+ public class Event {
+ private Long id;
+
+ private String title;
+ private Date date;
+
+ public Event() {}
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ }]]></programlisting>
+ </example>
+ <para>
+ <!-- todo : what's the best way to refer to content in other books? -->
+ <!-- like here it would be nice to say something like: -->
+ <!-- "Entity class requirements are covered in detail in <x.y.z Some Developer Guide Chapter/Section>" -->
+ A few things to notice about the entity
+ <itemizedlist>
+ <listitem>
+ <para>
+ This class uses standard JavaBean naming conventions for property getter and setter
+ methods, as well as private visibility for the fields. Although this is the
+ recommended design, it is not required.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The no-argument constructor (also a JavaBean convention) is a requirement for all
+ persistent classes. Hibernate has to create objects for you, using Java Reflection. The
+ constructor could be private, however package or public visibility is required for runtime
+ proxy generation and efficient data retrieval without bytecode instrumentation.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </step>
+
+ <step id="hibernate-gsg-tutorial-native-mapping">
+ <title>Write the entity mapping file</title>
+
+ <para>
+ Create a file named <filename>src/main/resources/org/hibernate/tutorial/native/Event.hbm.xml</filename>
+ with the following contents:
+ </para>
+
+ <example>
+ <title><filename>Event.hbm.xml</filename></title>
+ <programlisting role="XML"><![CDATA[
+<hibernate-mapping package="org.hibernate.tutorial.native">
+
+ <class name="Event" table="EVENTS">
+ <id name="id" column="EVENT_ID">
+ <generator class="enhanced-sequence"/>
+ </id>
+ <property name="date" type="timestamp" column="EVENT_DATE"/>
+ <property name="title"/>
+ </class>
+
+</hibernate-mapping>]]></programlisting>
+ </example>
+
+ <para>
+ Hibernate needs to know how to load and store objects of the persistent class. This is where the
+ "mapping metadata" comes into play. The Hibernate mapping file is one choice for providing Hibernate
+ with this metadata.
+ </para>
+
+ <para>
+ The <literal>class</literal> element here is doing 2 things.
+ <orderedlist>
+ <listitem>
+ <para>
+ The <literal>class</literal> attribute (here combined with the <literal>package</literal>
+ attribute from the containing <literal>hibernate-mapping</literal> element) names the FQN
+ of the class we want to define as an entity.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The <literal>table</literal> attribute names the database table which contains the data
+ for this entity.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ Instances of <classname>Event</classname> are now "mapped" to rows in the <literal>EVENTS</literal> table.
+ But an assumption there is that Hibernate knows how to uniquely identify rows in the table. This is the
+ purpose of the <literal>id</literal> element. It names the column(s) which uniquely identify each row.
+ </para>
+ <note>
+ <para>
+ It is not strictly necessary that the <literal>id</literal> element map to the table's
+ actual primary key column(s); however that is the normal convention. Nor is it strictly
+ necessary that tables mapped in Hibernate even define primary keys, the Hibernate team
+ <emphasis>highly</emphasis> recommends all schemas define proper referential integrity.
+ Therefore <literal>id</literal> and primary key are used interchangeably throughout Hibernate
+ documentation.
+ </para>
+ </note>
+ <para>
+ The <literal>id</literal> element here identifies the <literal>EVENT_ID</literal> column as the primary
+ key of the <literal>EVENTS</literal> table. Further, it names the <literal>id</literal> property of
+ the <classname>Event</classname> class is the property to hold the identifier value.
+ </para>
+ <para>
+ In regards to the <literal>generator</literal> element nested inside the <literal>id</literal> element,
+ for now just be aware that it tells Hibernate the strategy used to generated primary key values for
+ this entity. Here we are telling it to use a sequence-like value generation.
+ </para>
+ <para>
+ The 2 <literal>property</literal> elements are declaring the remaining 2 properties of the
+ <classname>Event</classname> class: <literal>date</literal> and <literal>title</literal>. Notice
+ that the <literal>date</literal> property mapping include the <literal>column</literal>
+ attribute, but the <literal>title</literal> does not. Without the <literal>column</literal>
+ attribute, Hibernate by default uses the property name as the column name. This works for
+ <literal>title</literal>, however, <literal>date</literal> is a reserved keyword in most databases
+ so you will need to explicitly tell Hibernate the column name in this case.
+ </para>
+ <para>
+ The <literal>title</literal> mapping also lacks a <literal>type</literal> attribute. The
+ types declared and used in the mapping files are not Java data types; they are not SQL
+ database types either. These types are called <emphasis>Hibernate mapping types</emphasis>,
+ converters which can translate from Java to SQL data types and vice versa. Hibernate will try to
+ determine the correct conversion and mapping type itself if the <literal>type</literal> attribute is not
+ present in the mapping by using Java reflection to determine the Java type of the declared property
+ and using a default mapping type for that Java type. In some cases this automatic detection might not
+ have the default you expect or need. This is the case with the <literal>date</literal> property.
+ Hibernate cannot know if the property, which is of type <classname>java.util.Date</classname>, should
+ map to a SQL <literal>DATE</literal>, <literal>TIME</literal>, or <literal>TIMESTAMP</literal> datatype.
+ Full date and time information is preserved by mapping the property with a <literal>timestamp</literal>
+ converter.
+ </para>
+
+ <tip>
+ <para>
+ Hibernate makes this mapping type determination using reflection when the mapping files
+ are processed. This can take time and resources, so if startup performance is important
+ you should consider explicitly defining the type to use.
+ </para>
+ </tip>
+
+ </step>
+
+ <step id="hibernate-gsg-tutorial-native-config">
+ <title>Create a Hibernate configuration file</title>
+
+ <para>
+ Create a file named <filename>src/main/resources/hibernate.cfg.xml</filename>
+ with the following contents:
+ </para>
+
+ <example id="hibernate-gsg-tutorial-native-config-ex1">
+ <title><filename>hibernate.cfg.xml</filename></title>
+ <programlisting role="XML"><![CDATA[<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+
+ <session-factory>
+
+ <!-- Database connection settings -->
+ <property name="connection.driver_class">org.h2.Driver</property>
+ <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
+ <property name="connection.username">sa</property>
+ <property name="connection.password"></property>
+
+ <!-- JDBC connection pool (use the built-in) -->
+ <property name="connection.pool_size">1</property>
+
+ <!-- SQL dialect -->
+ <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+
+ <!-- Disable the second-level cache -->
+ <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
+
+ <!-- Echo all executed SQL to stdout -->
+ <property name="show_sql">true</property>
+
+ <!-- Drop and re-create the database schema on startup -->
+ <property name="hbm2ddl.auto">update</property>
+
+ <mapping resource="org/hibernate/tutorial/native/domain/Event.hbm.xml"/>
+
+ </session-factory>
+
+</hibernate-configuration>]]></programlisting>
+ </example>
+
+ <para>
+ The first few <literal>property</literal> are defining JDBC connection information. These tutorials
+ utilize the H2 in-memory database. So these are all specific to running H2 in its in-memory mode.
+ The 'connection.pool_size' is used to configure Hibernate's built-in connection pool how many connections
+ to pool.
+ </para>
+
+ <caution>
+ <para>
+ The built-in Hibernate connection pool is in no way intended for production use. It
+ lacks several features found on any decent connection pool.
+ </para>
+ </caution>
+
+ <para>
+ The <literal>dialect</literal> option specifies the particular SQL variant Hibernate should generate.
+ </para>
+
+ <tip>
+ <para>
+ In most cases, Hibernate is able to properly determine which dialect to use which is invaluable if your
+ application targets multiple databases.
+ </para>
+ </tip>
+
+ <para>
+ The <literal>hbm2ddl.auto</literal> option turns on automatic generation of
+ database schemas directly into the database.
+ </para>
+ <para>
+ Finally, add the mapping file(s) for persistent classes to the configuration.
+ </para>
+ </step>
+
+ <step id="hibernate-gsg-tutorial-native-working">
+ <title>Do stuff</title>
+ <para>
+ Create a file named <filename>src/main/java/org/hibernate/tutorial/native/EvetManager.java</filename>
+ with the following contents:
+ </para>
+
+ <example id="hibernate-gsg-tutorial-native-working-ex1">
+ <title><filename>EventManager.java</filename></title>
+ <programlisting role="JAVA"><![CDATA[package org.hibernate.tutorial.native;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+
+import java.util.Date;
+
+public class EventManager {
+ private final SessionFactory sessionFactory;
+
+ public static void main(String[] args) {
+ EventManager eventManager = new EventManager();
+
+ if ( args[0].equals( "store" ) ) {
+ eventManager.createAndStoreEvent( "My Event", new Date() );
+ }
+ else if (args[0].equals("list")) {
+ List events = mgr.listEvents();
+ for (int i = 0; i < events.size(); i++) {
+ Event theEvent = (Event) events.get(i);
+ System.out.println(
+ "Event: " + theEvent.getTitle()
+ + " Time: " + theEvent.getDate()
+ );
+ }
+ }
+
+ eventManager.release();
+ }
+
+ public EventManager() {
+ sessionFactory = new Configuration()
+ .configure() // configures settings from hibernate.cfg.xml
+ .buildSessionFactory();
+ }
+
+ public void release() {
+ sessionFactory.close();
+ }
+
+ private void createAndStoreEvent(String title, Date theDate) {
+ Session session = sessionFactory.openSession();
+ session.beginTransaction();
+
+ Event theEvent = new Event();
+ theEvent.setTitle( title );
+ theEvent.setDate( theDate );
+ session.save( theEvent );
+
+ session.getTransaction().commit();
+ session.close();
+ }
+
+ private List listEvents() {
+ Session session = sessionFactory.openSession();
+ session.beginTransaction();
+ List result = session.createQuery("from Event").list();
+ session.getTransaction().commit();
+ session.close();
+ return result;
+ }
+}]]></programlisting>
+ </example>
+
+ <para>
+ The <classname>org.hibernate.cfg.Configuration</classname> class is the first thing to notice. In this
+ tutorial we simply configure everything via the <filename>hibernate.cfg.xml</filename> file
+ discussed in <xref linkend="hibernate-gsg-tutorial-native-config"/>.
+ </para>
+
+ <para>
+ The <classname>org.hibernate.cfg.Configuration</classname> is then used to create the
+ <interfacename>org.hibernate.SessionFactory</interfacename> which is a
+ thread-safe object that is instantiated once to serve the entire application.
+ </para>
+
+ <para>
+ The <interfacename>org.hibernate.SessionFactory</interfacename> acts as a factory for
+ <interfacename>org.hibernate.Session</interfacename> instances as can be seen in the
+ <methodname>createAndStoreEvent</methodname> and <methodname>listEvents</methodname> methods of the
+ <classname>EventManager</classname> class. A <interfacename>org.hibernate.Session</interfacename>
+ should be thought of as a corollary to a "unit of work". <!-- todo : reference to a discussion in dev guide -->
+ </para>
+
+ <para>
+ <methodname>createAndStoreEvent</methodname> creates a new <classname>Event</classname> object
+ and hands it over to Hibernate for "management". At that point, Hibernate takes responsibility to
+ perform an <literal>INSERT</literal> on the database.
+ </para>
+
+ <para>
+ <methodname>listEvents</methodname> illustrates use of the Hibernate Query Language (HQL) to load all
+ existing <classname>Event</classname> objects from the database. Hibernate will generate the
+ appropriate <literal>SELECT</literal> SQL, send it to the database and populate
+ <classname>Event</classname> objects with the result set data.
+ </para>
+ </step>
+
+ <step id="hibernate-gsg-tutorial-native-compile">
+ <title>Compile the source</title>
+ <screen>
+[hibernateTutorial]$ mvn compile
+[INFO] Scanning for projects...
+[INFO] ------------------------------------------------------------------------
+[INFO] Building First Hibernate Tutorial
+[INFO] task-segment: [compile]
+[INFO] ------------------------------------------------------------------------
+[INFO] [resources:resources]
+[INFO] Using default encoding to copy filtered resources.
+[INFO] [compiler:compile]
+[INFO] Compiling 2 source file to hibernateTutorial/target/classes
+[INFO] ------------------------------------------------------------------------
+[INFO] BUILD SUCCESSFUL
+[INFO] ------------------------------------------------------------------------
+[INFO] Total time: 2 seconds
+[INFO] Finished at: Tue Jun 09 12:25:25 CDT 2009
+[INFO] Final Memory: 5M/547M
+[INFO] ------------------------------------------------------------------------
+ </screen>
+ </step>
+
+ <step id="hibernate-gsg-tutorial-native-running">
+ <title>Running the code</title>
+ <para>
+ To perform a store (leveraging the maven exec plugin):
+ <command>mvn exec:java -Dexec.mainClass="org.hibernate.tutorial.native.EventManager" -Dexec.args="store"</command>
+ You should see Hibernate starting up and, depending on your configuration, lots of log output. Towards
+ the end, the following line will be displayed:
+ <screen>[java] Hibernate: insert into EVENTS (EVENT_DATE, title, EVENT_ID) values (?, ?, ?)</screen>
+ This is the <literal>INSERT</literal> executed by Hibernate.
+ </para>
+
+ <para>
+ To perform a list:
+ <command>mvn exec:java -Dexec.mainClass="org.hibernate.tutorial.native.EventManager" -Dexec.args="list"</command>
+ </para>
+
+ <note>
+ <para>
+ Currently nothing will ever be output when performing the list because the database is recreated
+ every time the <interfacename>org.hibernate.SessionFactory</interfacename> is created. See the
+ </para>
+ </note>
+ </step>
+ </procedure>
+
+ <para>
+ Take it further! Try the following:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Reconfigure the examples to connect to your own persistent relational database.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ With help of the Developer Guide, add an association to the <classname>Event</classname> entity
+ to model a message thread.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+</chapter>
\ No newline at end of file
13 years, 9 months