You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
| 2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
| 2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
| 2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
| 2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
| 2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
| 2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
| 2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <hib...@li...> - 2006-04-05 00:33:28
|
Author: max...@jb...
Date: 2006-04-04 20:33:20 -0400 (Tue, 04 Apr 2006)
New Revision: 9734
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideBinder.java
trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml
Log:
id-class replacing composite-id-class
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideBinder.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideBinder.java 2006-04-04 21:07:07 UTC (rev 9733)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideBinder.java 2006-04-05 00:33:20 UTC (rev 9734)
@@ -92,7 +92,7 @@
if(identifier==null) return;
String propertyName = identifier.attributeValue("property");
- String compositeIdName = identifier.attributeValue("composite-id-class");
+ String compositeIdName = identifier.attributeValue("id-class");
Element element = identifier.element("generator");
if(element!=null) {
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd 2006-04-04 21:07:07 UTC (rev 9733)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd 2006-04-05 00:33:20 UTC (rev 9734)
@@ -75,8 +75,8 @@
<!ELEMENT primary-key (generator?, key-column*) >
<!-- Property name to use for this primary key -->
<!ATTLIST primary-key property CDATA #IMPLIED >
-<!-- Class to use if primary-key is a composite -->
-<!ATTLIST primary-key composite-id-class CDATA #IMPLIED >
+<!-- Class to use for representing the id -->
+<!ATTLIST primary-key id-class CDATA #IMPLIED >
<!ELEMENT generator (param*)>
<!ATTLIST generator class CDATA #REQUIRED>
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml 2006-04-04 21:07:07 UTC (rev 9733)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml 2006-04-05 00:33:20 UTC (rev 9734)
@@ -45,7 +45,7 @@
alter table Customer add constraint 'max' foreign key (addressid, x) references address (dfdf)
-->
<table name="ORDERS">
- <primary-key property="customOrderId" composite-id-class="CustomOID">
+ <primary-key property="customOrderId" id-class="CustomOID">
<!-- <column name="CUSTID" foreign-table="CUSTOMER" foreign-column="CUSTID" /> -->
<key-column name="ORDERID"/>
<key-column name="CUSTID"/>
|
|
From: <hib...@li...> - 2006-04-04 21:08:53
|
Author: epbernard
Date: 2006-04-04 17:07:07 -0400 (Tue, 04 Apr 2006)
New Revision: 9733
Added:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/Version.java
Removed:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java
Log:
ANN-304 move to a safier package
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-04-04 16:40:10 UTC (rev 9732)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-04-04 21:07:07 UTC (rev 9733)
@@ -23,6 +23,7 @@
import org.dom4j.Element;
import org.hibernate.AnnotationException;
import org.hibernate.MappingException;
+import org.hibernate.cfg.annotations.Version;
import org.hibernate.validator.ClassValidator;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Join;
Deleted: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java 2006-04-04 16:40:10 UTC (rev 9732)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java 2006-04-04 21:07:07 UTC (rev 9733)
@@ -1,19 +0,0 @@
-//$Id: $
-package org.hibernate.cfg;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author Emmanuel Bernard
- */
-public class Version {
- public static String VERSION = "3.2.beta10";
- private static Log log = LogFactory.getLog( Version.class );
-
- static {
- log.info( "Hibernate Annotations " + VERSION );
- }
-
- public static void touch() {}
-}
Copied: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/Version.java (from rev 9731, trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java)
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java 2006-04-04 16:33:47 UTC (rev 9731)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/Version.java 2006-04-04 21:07:07 UTC (rev 9733)
@@ -0,0 +1,19 @@
+//$Id: $
+package org.hibernate.cfg.annotations;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Version {
+ public static String VERSION = "3.2.beta10";
+ private static Log log = LogFactory.getLog( Version.class );
+
+ static {
+ log.info( "Hibernate Annotations " + VERSION );
+ }
+
+ public static void touch() {}
+}
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java 2006-04-04 16:40:10 UTC (rev 9732)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java 2006-04-04 21:07:07 UTC (rev 9733)
@@ -16,7 +16,7 @@
import org.apache.lucene.index.Term;
import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
-import org.hibernate.cfg.Version;
+import org.hibernate.cfg.annotations.Version;
public class DocumentBuilder<T> {
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java 2006-04-04 16:40:10 UTC (rev 9732)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java 2006-04-04 21:07:07 UTC (rev 9733)
@@ -28,7 +28,7 @@
import org.hibernate.AssertionFailure;
import org.hibernate.Hibernate;
import org.hibernate.MappingException;
-import org.hibernate.cfg.Version;
+import org.hibernate.cfg.annotations.Version;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.reflection.Filter;
|
|
From: <hib...@li...> - 2006-04-04 16:40:47
|
Author: epbernard
Date: 2006-04-04 12:40:10 -0400 (Tue, 04 Apr 2006)
New Revision: 9732
Added:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Version.java
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/HibernatePersistence.java
Log:
EJB-157
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-04-04 16:33:47 UTC (rev 9731)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-04-04 16:40:10 UTC (rev 9732)
@@ -67,6 +67,11 @@
public class Ejb3Configuration implements Serializable {
private static final String IMPLEMENTATION_NAME = HibernatePersistence.class.getName();
private static Log log = LogFactory.getLog( Ejb3Configuration.class );
+
+ static {
+ Version.touch();
+ }
+
private AnnotationConfiguration cfg;
private SettingsFactory settingsFactory;
private EventListenerConfigurator listenerConfigurator;
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/HibernatePersistence.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/HibernatePersistence.java 2006-04-04 16:33:47 UTC (rev 9731)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/HibernatePersistence.java 2006-04-04 16:40:10 UTC (rev 9732)
@@ -30,7 +30,7 @@
*/
public static final String NON_JTA_DATASOURCE = "javax.persistence.nonJtaDataSource";
/**
- * PAR autodetection artifacts class, hbm
+ * JAR autodetection artifacts class, hbm
*/
public static final String AUTODETECTION = "hibernate.archive.autodetection";
/**
Added: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Version.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Version.java 2006-04-04 16:33:47 UTC (rev 9731)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Version.java 2006-04-04 16:40:10 UTC (rev 9732)
@@ -0,0 +1,19 @@
+//$Id: $
+package org.hibernate.ejb;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Version {
+ public static String VERSION = "3.2.beta8";
+ private static Log log = LogFactory.getLog( Version.class );
+
+ static {
+ log.info( "Hibernate EntityManager " + VERSION );
+ }
+
+ public static void touch() {}
+}
|
Author: epbernard
Date: 2006-04-04 12:33:47 -0400 (Tue, 04 Apr 2006)
New Revision: 9731
Added:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java
trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/version/
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java
Log:
ANN-304
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-04-03 17:00:19 UTC (rev 9730)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java 2006-04-04 16:33:47 UTC (rev 9731)
@@ -43,6 +43,9 @@
*/
public class AnnotationConfiguration extends Configuration {
private static Log log = LogFactory.getLog( AnnotationConfiguration.class );
+ static {
+ Version.touch(); //touch version
+ }
public static final String ARTEFACT = "hibernate.mapping.precedence";
public static final String DEFAULT_PRECEDENCE = "hbm, class";
Added: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java 2006-04-03 17:00:19 UTC (rev 9730)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/Version.java 2006-04-04 16:33:47 UTC (rev 9731)
@@ -0,0 +1,19 @@
+//$Id: $
+package org.hibernate.cfg;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class Version {
+ public static String VERSION = "3.2.beta10";
+ private static Log log = LogFactory.getLog( Version.class );
+
+ static {
+ log.info( "Hibernate Annotations " + VERSION );
+ }
+
+ public static void touch() {}
+}
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java 2006-04-03 17:00:19 UTC (rev 9730)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/lucene/DocumentBuilder.java 2006-04-04 16:33:47 UTC (rev 9731)
@@ -16,9 +16,14 @@
import org.apache.lucene.index.Term;
import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
+import org.hibernate.cfg.Version;
public class DocumentBuilder<T> {
+ static {
+ Version.touch(); //touch version
+ }
+
private final List<Member> keywordGetters = new ArrayList<Member>();
private final List<String> keywordNames = new ArrayList<String>();
private final List<Member> unstoredGetters = new ArrayList<Member>();
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java 2006-04-03 17:00:19 UTC (rev 9730)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/validator/ClassValidator.java 2006-04-04 16:33:47 UTC (rev 9731)
@@ -28,6 +28,7 @@
import org.hibernate.AssertionFailure;
import org.hibernate.Hibernate;
import org.hibernate.MappingException;
+import org.hibernate.cfg.Version;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.reflection.Filter;
@@ -59,6 +60,10 @@
INDEXABLE_CLASS.add( String.class );
}
+ static {
+ Version.touch(); //touch version
+ }
+
private final Class<T> beanClass;
private transient ResourceBundle messageBundle;
private transient boolean defaultResourceBundle;
|
|
From: <hib...@li...> - 2006-04-03 17:00:45
|
Author: epbernard
Date: 2006-04-03 13:00:19 -0400 (Mon, 03 Apr 2006)
New Revision: 9730
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
Log:
EJB-156
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-04-03 13:17:59 UTC (rev 9729)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-04-03 17:00:19 UTC (rev 9730)
@@ -31,7 +31,6 @@
import javassist.bytecode.ClassFile;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.MappingException;
@@ -48,8 +47,8 @@
import org.hibernate.ejb.packaging.PersistenceMetadata;
import org.hibernate.ejb.packaging.PersistenceXmlLoader;
import org.hibernate.ejb.transaction.JoinableCMTTransactionFactory;
-import org.hibernate.ejb.util.LogHelper;
import org.hibernate.ejb.util.ConfigurationHelper;
+import org.hibernate.ejb.util.LogHelper;
import org.hibernate.engine.FilterDefinition;
import org.hibernate.event.EventListeners;
import org.hibernate.mapping.AuxiliaryDatabaseObject;
@@ -685,9 +684,6 @@
else if (! hasTxStrategy && transactionType == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
preparedProperties.setProperty( Environment.TRANSACTION_STRATEGY, JDBCTransactionFactory.class.getName() );
}
- else {
- new AssertionFailure("Unknown PersisntenceUnitTransactionType: " + transactionType);
- }
if (hasTxStrategy) {
log.warn("Overriding " + Environment.TRANSACTION_STRATEGY + " is dangerous, this might break the EJB3 specification implementation");
}
|
|
From: <hib...@li...> - 2006-04-03 13:18:11
|
Author: max...@jb...
Date: 2006-04-03 09:17:59 -0400 (Mon, 03 Apr 2006)
New Revision: 9729
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/JDBCConfigurationTask.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/AbstractExporter.java
Log:
ws
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/JDBCConfigurationTask.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/JDBCConfigurationTask.java 2006-04-03 06:55:40 UTC (rev 9728)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/JDBCConfigurationTask.java 2006-04-03 13:17:59 UTC (rev 9729)
@@ -49,7 +49,7 @@
DefaultReverseEngineeringStrategy defaultStrategy = new DefaultReverseEngineeringStrategy();
if(packageName!=null) {
- (defaultStrategy).setPackageName(packageName);
+ defaultStrategy.setPackageName(packageName);
}
ReverseEngineeringStrategy strategy = defaultStrategy;
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/AbstractExporter.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/AbstractExporter.java 2006-04-03 06:55:40 UTC (rev 9728)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/AbstractExporter.java 2006-04-03 13:17:59 UTC (rev 9729)
@@ -172,9 +172,7 @@
throw new ExporterException("Exception when instantiating tool " + element.getKey() + " with " + value,e);
}
}
- }
-
-
+ }
}
}
getTemplateHelper().putInContext("artifacts", collector);
|
|
From: <hib...@li...> - 2006-04-03 06:55:44
|
Author: max...@jb...
Date: 2006-04-03 02:55:40 -0400 (Mon, 03 Apr 2006)
New Revision: 9728
Modified:
trunk/HibernateExt/tools/doc/reference/en/modules/ant.xml
Log:
fix doc bug
Modified: trunk/HibernateExt/tools/doc/reference/en/modules/ant.xml
===================================================================
--- trunk/HibernateExt/tools/doc/reference/en/modules/ant.xml 2006-04-01 21:34:47 UTC (rev 9727)
+++ trunk/HibernateExt/tools/doc/reference/en/modules/ant.xml 2006-04-03 06:55:40 UTC (rev 9728)
@@ -377,7 +377,7 @@
<para>If the templates need to access some user class it is possible
by specifying a "toolclass" in the properties.</para>
- <programlisting><![CDATA[<property key="sometool.toolclass" value="x.y.z.NameOfToolClass"/>
+ <programlisting><![CDATA[<property key="hibernatetool.sometool.toolclass" value="x.y.z.NameOfToolClass"/>
]]></programlisting>
<para>Placing the above <literal><property></literal> tag in
|
|
From: <hib...@li...> - 2006-04-01 21:35:23
|
Author: epbernard
Date: 2006-04-01 16:34:47 -0500 (Sat, 01 Apr 2006)
New Revision: 9727
Added:
trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/TestIsPropertyInitializedExecutable.java
Modified:
trunk/Hibernate3/src/org/hibernate/Hibernate.java
trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
Log:
HHH-1625
ANN-301
Modified: trunk/Hibernate3/src/org/hibernate/Hibernate.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/Hibernate.java 2006-04-01 14:08:20 UTC (rev 9726)
+++ trunk/Hibernate3/src/org/hibernate/Hibernate.java 2006-04-01 21:34:47 UTC (rev 9727)
@@ -428,7 +428,7 @@
if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
- return interceptor != null && interceptor.isInitialized( propertyName );
+ return interceptor == null || interceptor.isInitialized( propertyName );
}
else {
return true;
Modified: trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2006-04-01 14:08:20 UTC (rev 9726)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/AbstractTransformingClassLoaderInstrumentTestCase.java 2006-04-01 21:34:47 UTC (rev 9727)
@@ -1,12 +1,12 @@
package org.hibernate.test.instrument.runtime;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URL;
+
+import org.hibernate.HibernateException;
+import org.hibernate.bytecode.BytecodeProvider;
import org.hibernate.test.AbstractClassLoaderIsolatedTestCase;
-import org.hibernate.bytecode.BytecodeProvider;
-import org.hibernate.HibernateException;
-import java.net.URL;
-import java.lang.reflect.InvocationTargetException;
-
/**
* @author Steve Ebersole
*/
@@ -57,7 +57,11 @@
executeExecutable( "org.hibernate.test.instrument.runtime.TestLazyManyToOneExecutable" );
}
+ public void testPropertyInitialized() {
+ executeExecutable( "org.hibernate.test.instrument.runtime.TestIsPropertyInitializedExecutable" );
+ }
+
// reflection code to ensure isolation into the created classloader ~~~~~~~
private static final Class[] SIG = new Class[] {};
Added: trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/TestIsPropertyInitializedExecutable.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/TestIsPropertyInitializedExecutable.java 2006-04-01 14:08:20 UTC (rev 9726)
+++ trunk/Hibernate3/test/org/hibernate/test/instrument/runtime/TestIsPropertyInitializedExecutable.java 2006-04-01 21:34:47 UTC (rev 9727)
@@ -0,0 +1,48 @@
+//$Id: $
+package org.hibernate.test.instrument.runtime;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.Hibernate;
+import org.hibernate.test.instrument.domain.Owner;
+import org.hibernate.test.instrument.domain.Document;
+import org.hibernate.test.instrument.domain.Folder;
+import junit.framework.Assert;
+
+/**
+ * @author Steve Ebersole
+ */
+public class TestIsPropertyInitializedExecutable extends AbstractExecutable {
+ public void execute() {
+ Session s = getFactory().openSession();
+ Transaction t = s.beginTransaction();
+ Owner o = new Owner();
+ Document doc = new Document();
+ Folder fol = new Folder();
+ o.setName("gavin");
+ doc.setName("Hibernate in Action");
+ doc.setSummary("blah");
+ doc.updateText("blah blah");
+ fol.setName("books");
+ doc.setOwner(o);
+ doc.setFolder(fol);
+ fol.getDocuments().add(doc);
+ Assert.assertTrue( Hibernate.isPropertyInitialized( doc, "summary" ) );
+ s.persist(o);
+ s.persist(fol);
+ t.commit();
+ s.close();
+
+ s = getFactory().openSession();
+ t = s.beginTransaction();
+ doc = (Document) s.get( Document.class, doc.getId() );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( doc, "summary" ) );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( doc, "upperCaseName" ) );
+ Assert.assertFalse( Hibernate.isPropertyInitialized( doc, "owner" ) );
+ s.delete(doc);
+ s.delete( doc.getOwner() );
+ s.delete( doc.getFolder() );
+ t.commit();
+ s.close();
+ }
+}
|
Author: pgmjsd
Date: 2006-04-01 09:08:20 -0500 (Sat, 01 Apr 2006)
New Revision: 9726
Added:
branches/HQL_ANTLR_2/Hibernate3/grammar/hql-resolve.g
branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlResolver.java
branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlResolverTest.java
Modified:
branches/HQL_ANTLR_2/Hibernate3/build.xml
branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlASTFactory.java
branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/Node.java
branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlParserTest.java
Log:
First cut at a new query translator phase that will pre-process the HQL AST.
Modified: branches/HQL_ANTLR_2/Hibernate3/build.xml
===================================================================
--- branches/HQL_ANTLR_2/Hibernate3/build.xml 2006-04-01 00:02:15 UTC (rev 9725)
+++ branches/HQL_ANTLR_2/Hibernate3/build.xml 2006-04-01 14:08:20 UTC (rev 9726)
@@ -179,6 +179,11 @@
target="${grammar.dir}/hql.g"
outputdirectory="${parser.src}"
/>
+ <!-- The HQL resolver tree transform grammar -->
+ <antlrtask
+ target="${grammar.dir}/hql-resolve.g"
+ outputdirectory="${parser.src}"
+ />
<!-- The HQL-SQL tree transform grammar -->
<antlrtask
target="${grammar.dir}/hql-sql.g"
Added: branches/HQL_ANTLR_2/Hibernate3/grammar/hql-resolve.g
===================================================================
--- branches/HQL_ANTLR_2/Hibernate3/grammar/hql-resolve.g 2006-04-01 00:02:15 UTC (rev 9725)
+++ branches/HQL_ANTLR_2/Hibernate3/grammar/hql-resolve.g 2006-04-01 14:08:20 UTC (rev 9726)
@@ -0,0 +1,112 @@
+header
+{
+// $Id:$
+package org.hibernate.hql.antlr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+}
+
+/**
+ * Hibernate Query Language resolver phase.<br>
+ * This is a tree grammar that transforms an HQL AST into another HQL AST, resolving and normalizing
+ * sub-trees along the way.
+ * <br>
+ * <i>NOTE:</i> The java class is generated from hql-resolver.g by ANTLR.
+ * <i>DO NOT EDIT THE GENERATED JAVA SOURCE CODE.</i>
+ * @author Joshua Davis (jo...@hi...)
+ */
+class HqlBaseResolver extends TreeParser;
+
+options
+{
+ // Note: importVocab and exportVocab cause ANTLR to share the token type numbers between the
+ // two grammars. This means that the token type constants from the source tree are the same
+ // as those in the target tree. If this is not the case, tree translation can result in
+ // token types from the *source* tree being present in the target tree.
+ importVocab=Hql; // import definitions from "Hql"
+ exportVocab=HqlR; // The result is "HqlR", for "HQL, Resolved"
+ buildAST=true;
+}
+
+tokens
+{
+ BOGUS;
+}
+
+
+// -- Declarations --
+{
+ private static Log log = LogFactory.getLog( HqlBaseResolver.class );
+}
+
+// The main statement rule.
+statement
+ : selectStatement | updateStatement | deleteStatement | insertStatement
+ ;
+
+// --- HQL statements ---
+
+selectStatement
+ : query
+ ;
+
+updateStatement
+ : #(UPDATE (VERSIONED)? fromClause setClause (whereClause)? )
+ ;
+
+deleteStatement
+ : #(DELETE fromClause (whereClause)? )
+ ;
+
+insertStatement
+ : #(INSERT intoClause query )
+ ;
+
+query
+ : #(QUERY
+ // The first phase places the FROM first to make processing the SELECT simpler.
+ #(SELECT_FROM
+ fromClause
+ (selectClause)?
+ )
+ (whereClause)?
+ (groupClause)?
+ (orderClause)?
+ )
+ ;
+
+selectClause
+ : #(SELECT (DISTINCT)? (~DISTINCT)* )
+ ;
+
+// -- Language sub-elements --
+
+fromClause
+ : #(FROM (subtree)* )
+ ;
+
+intoClause
+ : #(INTO (subtree)* )
+ ;
+
+whereClause
+ : #(WHERE (subtree)* )
+ ;
+
+groupClause
+ : #(GROUP (subtree)* )
+ ;
+
+orderClause
+ : #(ORDER (subtree)* )
+ ;
+
+setClause
+ : #(SET (subtree)* )
+ ;
+
+// General subtree. Matches anything, copies the tree verbatim.
+subtree
+ : #(. (subtree)*)
+ ;
\ No newline at end of file
Modified: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlASTFactory.java
===================================================================
--- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlASTFactory.java 2006-04-01 00:02:15 UTC (rev 9725)
+++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlASTFactory.java 2006-04-01 14:08:20 UTC (rev 9726)
@@ -4,17 +4,20 @@
import org.hibernate.hql.ast.tree.Node;
/**
- * User: Joshua Davis<br>
- * Date: Sep 23, 2005<br>
- * Time: 12:30:01 PM<br>
+ * Use this AST factory to enable line/column tracking.
+ * <br>User: Joshua Davis
+ * Date: Sep 23, 2005
+ * Time: 12:30:01 PM
+ * @see antlr.TreeParser#setASTFactory(antlr.ASTFactory)
+ * @see antlr.Parser#setASTFactory(antlr.ASTFactory)
*/
public class HqlASTFactory extends ASTFactory {
/**
- * Returns the class for a given token type (a.k.a. AST node type).
- *
+ * Returns a node class that tracks line/column information.
* @param tokenType The token type.
* @return Class - The AST node class to instantiate.
+ * @see Node
*/
public Class getASTNodeType(int tokenType) {
return Node.class;
Added: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlResolver.java
===================================================================
--- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlResolver.java 2006-04-01 00:02:15 UTC (rev 9725)
+++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/HqlResolver.java 2006-04-01 14:08:20 UTC (rev 9726)
@@ -0,0 +1,16 @@
+package org.hibernate.hql.ast;
+
+import org.hibernate.hql.antlr.HqlBaseResolver;
+
+/**
+ * Implements the methods for the HqlBaseResolver.
+ * <br>User: Joshua Davis
+ * Date: Apr 1, 2006
+ * Time: 7:40:42 AM
+ */
+public class HqlResolver extends HqlBaseResolver {
+ public HqlResolver() {
+ super();
+ setASTFactory(new HqlASTFactory()); // Create nodes that track line and column number.
+ }
+}
Modified: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/Node.java
===================================================================
--- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/Node.java 2006-04-01 00:02:15 UTC (rev 9725)
+++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/Node.java 2006-04-01 14:08:20 UTC (rev 9726)
@@ -5,10 +5,14 @@
import org.hibernate.util.StringHelper;
/**
- * Generic AST Node.
- * User: Joshua Davis<br>
- * Date: Sep 23, 2005<br>
- * Time: 12:20:53 PM<br>
+ * Generic AST Node. Propagates line/column information during stream/string
+ * parsing (stream to AST) and during tree walking (AST to AST).
+ * To use this, make an ASTFactory that returns this class, or some sub-class
+ * from getASTNodeType().
+ * <br>User: Joshua Davis
+ * Date: Sep 23, 2005
+ * Time: 12:20:53 PM
+ * @see antlr.ASTFactory#getASTNodeType(int)
*/
public class Node extends antlr.CommonAST {
private String filename;
@@ -26,6 +30,8 @@
public void initialize(Token tok) {
super.initialize(tok);
+ // Propagate line/column information from the lexer during
+ // stream parsing.
filename = tok.getFilename();
line = tok.getLine();
column = tok.getColumn();
@@ -35,6 +41,8 @@
public void initialize(AST t) {
super.initialize(t);
+ // Propagate line/column information from the source AST
+ // during tree walking.
if (t instanceof Node)
{
Node n = (Node)t;
Modified: branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlParserTest.java
===================================================================
--- branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlParserTest.java 2006-04-01 00:02:15 UTC (rev 9725)
+++ branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlParserTest.java 2006-04-01 14:08:20 UTC (rev 9726)
@@ -1059,7 +1059,7 @@
doParse( input, false );
}
- private AST doParse(String input, boolean filter) throws RecognitionException, TokenStreamException {
+ public static AST doParse(String input, boolean filter) throws RecognitionException, TokenStreamException {
System.out.println( "input: ->" + ASTPrinter.escapeMultibyteChars(input) + "<-" );
HqlParser parser = HqlParser.getInstance( input );
parser.setFilter( filter );
Added: branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlResolverTest.java
===================================================================
--- branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlResolverTest.java 2006-04-01 00:02:15 UTC (rev 9725)
+++ branches/HQL_ANTLR_2/Hibernate3/test/org/hibernate/test/hql/HqlResolverTest.java 2006-04-01 14:08:20 UTC (rev 9726)
@@ -0,0 +1,45 @@
+package org.hibernate.test.hql;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+import antlr.collections.AST;
+import antlr.RecognitionException;
+import antlr.TokenStreamException;
+import org.hibernate.hql.ast.util.ASTPrinter;
+import org.hibernate.hql.ast.HqlParser;
+import org.hibernate.hql.ast.HqlResolver;
+import org.hibernate.hql.antlr.HqlRTokenTypes;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+/**
+ * Tests the new HQL resolver phase.
+ * <br>User: Joshua Davis
+ * Date: Apr 1, 2006
+ * Time: 7:25:37 AM
+ */
+public class HqlResolverTest extends TestCase {
+ private ASTPrinter hqlrPrinter = new ASTPrinter(HqlRTokenTypes.class);
+
+ public HqlResolverTest(String n) {
+ super(n);
+ }
+
+
+ public void testSimpleHql() throws Exception {
+ // First, get an AST by parsing some HQL text.
+ AST hqlAst = HqlParserTest.doParse("from Foo f, Bar b where f.x.id = b.id",false);
+ // Now, pass it though the resolver phase, which yeilds
+ // a processed HQL AST.
+ HqlResolver resolver = new HqlResolver();
+ resolver.statement(hqlAst);
+ AST resolvedHql = resolver.getAST();
+ System.out.println(hqlrPrinter.showAsString(resolvedHql,"Resolved AST : " + resolvedHql.toStringTree() + "" ));
+ }
+
+ public static Test suite() {
+ return new TestSuite(HqlResolverTest.class);
+ }
+}
|
|
From: <hib...@li...> - 2006-04-01 00:02:50
|
Author: epbernard
Date: 2006-03-31 19:02:15 -0500 (Fri, 31 Mar 2006)
New Revision: 9725
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/FkSecondPass.java
Log:
ANN-300
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-03-31 17:47:53 UTC (rev 9724)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-04-01 00:02:15 UTC (rev 9725)
@@ -1710,6 +1710,15 @@
mappings)
);
}
+ else {
+ String path = propertyHolder.getPath() + "." + propertyName;
+ mappings.addSecondPass(
+ new FkSecondPass(
+ value, columns,
+ !optional, //cannot have nullabe and unique on certain DBs
+ path, mappings )
+ );
+ }
PropertyBinder binder = new PropertyBinder();
binder.setName( propertyName );
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/FkSecondPass.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/FkSecondPass.java 2006-03-31 17:47:53 UTC (rev 9724)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/FkSecondPass.java 2006-04-01 00:02:15 UTC (rev 9725)
@@ -8,6 +8,7 @@
import org.hibernate.mapping.ManyToOne;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Value;
+import org.hibernate.mapping.OneToOne;
/**
* Enable a proper set of the FK columns in respect with the id column order
@@ -37,7 +38,7 @@
PersistentClass ref = (PersistentClass) persistentClasses.get( manyToOne.getReferencedEntityName() );
if ( ref == null ) {
throw new AnnotationException(
- "@OneToOne or @ManyToOne on " + path + " references an unknown entity: " + manyToOne.getReferencedEntityName()
+ "@OneToOne or @ManyToOne on " + path + " references an unknown entity: " + manyToOne.getReferencedEntityName()
);
}
BinderHelper.createSyntheticPropertyReference( columns, ref, null, manyToOne, false, mappings );
@@ -47,6 +48,9 @@
*/
if ( ! manyToOne.isIgnoreNotFound() ) manyToOne.createPropertyRefConstraints( persistentClasses );
}
+ else if ( value instanceof OneToOne ) {
+ ( (OneToOne) value ).createForeignKey();
+ }
else {
throw new AssertionFailure( "FkSecondPass for a wrong value type: " + value.getClass().getName() );
}
|
|
From: John <jv....@gm...> - 2006-03-31 19:51:31
|
|
From: <hib...@li...> - 2006-03-31 17:48:28
|
Author: ste...@jb...
Date: 2006-03-31 12:47:53 -0500 (Fri, 31 Mar 2006)
New Revision: 9724
Modified:
branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/HqlSqlWalker.java
branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/tree/FromElementType.java
Log:
HHH-1419 : missed applying to 3.1 branch originally
Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/HqlSqlWalker.java
===================================================================
--- branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/HqlSqlWalker.java 2006-03-31 15:41:05 UTC (rev 9723)
+++ branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/HqlSqlWalker.java 2006-03-31 17:47:53 UTC (rev 9724)
@@ -301,7 +301,7 @@
AST fetchNode,
AST propertyFetch,
AST with) throws SemanticException {
- boolean fetch = ( fetchNode != null ) ? true : false;
+ boolean fetch = ( fetchNode != null );
// The path AST should be a DotNode, and it should have been evaluated already.
if ( path.getType() != SqlTokenTypes.DOT ) {
throw new SemanticException( "Path expected for join!" );
@@ -765,8 +765,8 @@
}
ParameterNode parameter = ( ParameterNode ) astFactory.create( PARAM, "?" );
PositionalParameterSpecification paramSpec = new PositionalParameterSpecification(
- ( ( Node ) inputNode ).getLine(),
- ( ( Node ) inputNode ).getColumn(),
+ inputNode.getLine(),
+ inputNode.getColumn(),
positionalParameterCount++
);
parameter.setHqlParameterSpecification( paramSpec );
@@ -784,8 +784,8 @@
parameter.setText( "?" );
NamedParameterSpecification paramSpec = new NamedParameterSpecification(
- ( ( Node ) delimiterNode ).getLine(),
- ( ( Node ) delimiterNode ).getColumn(),
+ delimiterNode.getLine(),
+ delimiterNode.getColumn(),
name
);
parameter.setHqlParameterSpecification( paramSpec );
@@ -878,8 +878,11 @@
}
public FromClause getFinalFromClause() {
- //TODO: more correct implementation
- return currentFromClause;
+ FromClause top = currentFromClause;
+ while ( top.getParentFromClause() != null ) {
+ top = top.getParentFromClause();
+ }
+ return top;
}
public boolean isShallowQuery() {
Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/tree/FromElementType.java
===================================================================
--- branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/tree/FromElementType.java 2006-03-31 15:41:05 UTC (rev 9723)
+++ branches/Branch_3_1/Hibernate3/src/org/hibernate/hql/ast/tree/FromElementType.java 2006-03-31 17:47:53 UTC (rev 9724)
@@ -5,6 +5,7 @@
import org.hibernate.MappingException;
import org.hibernate.QueryException;
+import org.hibernate.util.ArrayHelper;
import org.hibernate.engine.JoinSequence;
import org.hibernate.hql.CollectionProperties;
import org.hibernate.hql.CollectionSubqueryFactory;
@@ -152,8 +153,7 @@
}
private static String generateSuffix(int size, int k) {
- String suffix = size == 1 ? "" : Integer.toString( k ) + '_';
- return suffix;
+ return size == 1 ? "" : Integer.toString( k ) + '_';
}
private void checkInitialized() {
@@ -308,20 +308,66 @@
return new String[]{"(" + subquery + ")"};
}
else {
- // decide if we need to use table-alias qualification
- boolean useTableAlias = fromElement.getWalker().getStatementType() == HqlSqlTokenTypes.SELECT
- || fromElement.getWalker().getCurrentClauseType() == HqlSqlTokenTypes.SELECT
- || fromElement.getWalker().isSubQuery()
- || forceAlias;
- if ( useTableAlias ) {
+ if ( forceAlias ) {
return propertyMapping.toColumns( tableAlias, path );
}
+ else if ( fromElement.getWalker().getStatementType() == HqlSqlTokenTypes.SELECT ) {
+ return propertyMapping.toColumns( tableAlias, path );
+ }
+ else if ( fromElement.getWalker().getCurrentClauseType() == HqlSqlTokenTypes.SELECT ) {
+ return propertyMapping.toColumns( tableAlias, path );
+ }
+ else if ( fromElement.getWalker().isSubQuery() ) {
+ // for a subquery, the alias to use depends on a few things (we
+ // already know this is not an overall SELECT):
+ // 1) if this FROM_ELEMENT represents a correlation to the
+ // outer-most query
+ // A) if the outer query represents a multi-table
+ // persister, we need to use the given alias
+ // in anticipation of one of the multi-table
+ // executors being used (as this subquery will
+ // actually be used in the "id select" phase
+ // of that multi-table executor)
+ // B) otherwise, we need to use the persister's
+ // table name as the column qualification
+ // 2) otherwise (not correlated), use the given alias
+ if ( isCorrelation() ) {
+ if ( isMultiTable() ) {
+ return propertyMapping.toColumns( tableAlias, path );
+ }
+ else {
+ return propertyMapping.toColumns( extractTableName(), path );
+ }
+ }
+ else {
+ return propertyMapping.toColumns( tableAlias, path );
+ }
+ }
else {
- return propertyMapping.toColumns( path );
+ String[] columns = propertyMapping.toColumns( path );
+ log.warn( "Using non-qualified column reference [" + path + " -> (" + ArrayHelper.toString( columns ) + ")]" );
+ return columns;
}
}
}
+ private boolean isCorrelation() {
+ FromClause top = fromElement.getWalker().getFinalFromClause();
+ return fromElement.getFromClause() != fromElement.getWalker().getCurrentFromClause() &&
+ fromElement.getFromClause() == top;
+ }
+
+ private boolean isMultiTable() {
+ // should be safe to only ever expect EntityPersister references here
+ return fromElement.getQueryable() != null &&
+ fromElement.getQueryable().isMultiTable();
+ }
+
+ private String extractTableName() {
+ // should be safe to only ever expect EntityPersister references here
+ return fromElement.getQueryable().getTableName();
+ }
+
PropertyMapping getPropertyMapping(String propertyName) {
checkInitialized();
if ( queryableCollection == null ) { // Not a collection?
|
Author: max...@jb...
Date: 2006-03-31 10:41:05 -0500 (Fri, 31 Mar 2006)
New Revision: 9723
Modified:
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DelegatingReverseEngineeringStrategy.java
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCToHibernateTypeHelper.java
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java
trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/ReverseEngineeringStrategy.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/DefaultReverseEngineeringStrategyTest.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OverrideBinderTest.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml
trunk/HibernateExt/tools/src/testsupport/NoopReverseEngineeringStrategy.java
Log:
HBX-617 primary keys "nullablility" should be affected by the identifier strategy
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/JDBCBinder.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -260,7 +260,7 @@
while ( columnIterator.hasNext() ) {
Column fkcolumn = (Column) columnIterator.next();
if(fkcolumn.getSqlTypeCode()!=null) { // TODO: user defined foreign ref columns does not have a type set.
- guessAndAlignType(collectionTable, fkcolumn, mapping); // needed to ensure foreign key columns has same type as the "property" column.
+ guessAndAlignType(collectionTable, fkcolumn, mapping, false); // needed to ensure foreign key columns has same type as the "property" column.
}
keyValue.addColumn( fkcolumn );
}
@@ -305,6 +305,10 @@
}
final TableIdentifier tableIdentifier = TableIdentifier.create(table);
+
+ String tableIdentifierStrategyName = revengStrategy.getTableIdentifierStrategyName(tableIdentifier);
+ boolean naturalId = "assigned".equals(tableIdentifierStrategyName);
+
if (keyColumns.size()>1) {
id = handleCompositeKey(rc, processed, keyColumns, mapping);
idPropertyname = revengStrategy.tableToIdentifierPropertyName(tableIdentifier);
@@ -316,7 +320,7 @@
Column pkc = (Column) keyColumns.get(0);
checkColumn(pkc);
- id = bindColumnToSimpleValue(table, pkc, mapping);
+ id = bindColumnToSimpleValue(table, pkc, mapping, !naturalId);
idPropertyname = revengStrategy.tableToIdentifierPropertyName(tableIdentifier);
if(idPropertyname==null) {
@@ -325,12 +329,13 @@
processed.add(pkc);
}
- id.setIdentifierGeneratorStrategy(revengStrategy.getTableIdentifierStrategyName(tableIdentifier));
+ id.setIdentifierGeneratorStrategy(tableIdentifierStrategyName);
id.setIdentifierGeneratorProperties(revengStrategy.getTableIdentifierProperties(tableIdentifier));
- if("assigned".equals(id.getIdentifierGeneratorStrategy())) {
+ if(naturalId) {
id.setNullValue("undefined");
}
+
Property property = makeProperty(makeUnique(rc,idPropertyname), id, true, true, false, null, null);
rc.setIdentifierProperty(property);
rc.setIdentifier(id);
@@ -446,15 +451,15 @@
private Property bindBasicProperty(String propertyName, Table table, Column column, Set processedColumns, Mapping mapping) {
- SimpleValue value = bindColumnToSimpleValue( table, column, mapping );
+ SimpleValue value = bindColumnToSimpleValue( table, column, mapping, false );
return makeProperty(propertyName, value, true, true, false, null, null);
}
- private SimpleValue bindColumnToSimpleValue(Table table, Column column, Mapping mapping) {
+ private SimpleValue bindColumnToSimpleValue(Table table, Column column, Mapping mapping, boolean generatedIdentifier) {
SimpleValue value = new SimpleValue(table);
value.addColumn(column);
- value.setTypeName(guessAndAlignType(table, column, mapping));
+ value.setTypeName(guessAndAlignType(table, column, mapping, generatedIdentifier));
return value;
}
@@ -481,9 +486,10 @@
/**
* @param column
+ * @param generatedIdentifier
* @return
*/
- private String guessAndAlignType(Table table, Column column, Mapping mapping) {
+ private String guessAndAlignType(Table table, Column column, Mapping mapping, boolean generatedIdentifier) {
// TODO: this method mutates the column if the types does not match...not good.
// maybe we should copy the column instead before calling this method.
Integer sqlTypeCode = column.getSqlTypeCode();
@@ -496,7 +502,7 @@
TableIdentifier.create(table),
column.getName(),
sqlTypeCode.intValue(),
- column.getLength(), column.getPrecision(), column.getScale(), column.isNullable()
+ column.getLength(), column.getPrecision(), column.getScale(), column.isNullable(), generatedIdentifier
);
Type wantedType = TypeFactory.heuristicType(preferredHibernateType);
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DefaultReverseEngineeringStrategy.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -102,8 +102,8 @@
return packageName;
}
- public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable) {
- String preferredHibernateType = JDBCToHibernateTypeHelper.getPreferredHibernateType(sqlType, length, precision, scale, nullable);
+ public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier) {
+ String preferredHibernateType = JDBCToHibernateTypeHelper.getPreferredHibernateType(sqlType, length, precision, scale, nullable, generatedIdentifier);
if(preferredHibernateType==null) {
log.debug("No preferred hibernate type found for " + table.toString() + " column: " + columnName + " falling back to 'serializable'");
return "serializable";
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DelegatingReverseEngineeringStrategy.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DelegatingReverseEngineeringStrategy.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/DelegatingReverseEngineeringStrategy.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -38,8 +38,8 @@
return delegate==null?null:delegate.foreignKeyToEntityName(keyname, fromTable, fromColumnNames, referencedTable, referencedColumnNames, uniqueReference);
}
- public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable) {
- return delegate==null?null:delegate.columnToHibernateTypeName(table, columnName, sqlType, length, precision, scale, nullable);
+ public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier) {
+ return delegate==null?null:delegate.columnToHibernateTypeName(table, columnName, sqlType, length, precision, scale, nullable, generatedIdentifier);
}
public String tableToClassName(TableIdentifier tableIdentifier) {
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCToHibernateTypeHelper.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCToHibernateTypeHelper.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/JDBCToHibernateTypeHelper.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -59,23 +59,24 @@
/* (non-Javadoc)
* @see org.hibernate.cfg.JDBCTypeToHibernateTypesStrategy#getPreferredHibernateType(int, int, int, int)
*/
- public static String getPreferredHibernateType(int sqlType, int size, int precision, int scale, boolean nullable) {
- if ( (sqlType == Types.DECIMAL || sqlType == Types.NUMERIC) && scale <= 0) { // <=
+ public static String getPreferredHibernateType(int sqlType, int size, int precision, int scale, boolean nullable, boolean generatedIdentifier) {
+ boolean returnNullable = nullable || generatedIdentifier;
+ if ( (sqlType == Types.DECIMAL || sqlType == Types.NUMERIC) && scale <= 0) { // <=
if (precision == 1) {
// NUMERIC(1) is a often used idiom for storing boolean thus providing it out of the box.
- return nullable?Boolean.class.getName():"boolean";
+ return returnNullable?Boolean.class.getName():"boolean";
}
else if (precision < 3) {
- return nullable?Byte.class.getName():"byte";
+ return returnNullable?Byte.class.getName():"byte";
}
else if (precision < 5) {
- return nullable?Short.class.getName():"short";
+ return returnNullable?Short.class.getName():"short";
}
else if (precision < 10) {
- return nullable?Integer.class.getName():"integer";
+ return returnNullable?Integer.class.getName():"integer";
}
else if (precision < 19) {
- return nullable?Long.class.getName():"long";
+ return returnNullable?Long.class.getName():"long";
}
else {
return "big_decimal";
@@ -90,7 +91,7 @@
if(result==null) {
return null;
- } else if(nullable) {
+ } else if(returnNullable) {
return result[1];
} else {
return result[0];
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/OverrideRepository.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -282,7 +282,7 @@
}
}
- public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable) {
+ public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier) {
String result = null;
String location = "";
if(table!=null) {
@@ -300,7 +300,7 @@
result = OverrideRepository.this.getPreferredHibernateType(sqlType, length, precision, scale, nullable);
if(result==null) {
- return super.columnToHibernateTypeName(table, columnName, sqlType, length, precision, scale, nullable);
+ return super.columnToHibernateTypeName(table, columnName, sqlType, length, precision, scale, nullable, generatedIdentifier);
}
else {
log.debug("columnToHibernateTypeName, <type-mapping> found: " + result + " for " + location);
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/ReverseEngineeringStrategy.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/ReverseEngineeringStrategy.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/cfg/reveng/ReverseEngineeringStrategy.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -51,10 +51,11 @@
* @param length The length of the column.
* @param precision The number of decimal digits, if applicable.
* @param scale The scale, if applicable.
- * @param nullable TODO
+ * @param nullable The nullability of the column
+ * @param generatedIdentifier true if for a column used in an identifier that is not "assigned", false otherwise.
* @return The Preferred hibernate type name.
*/
- public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable);
+ public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier);
/**
* Gets the user defined foreign keys.
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/DefaultReverseEngineeringStrategyTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/DefaultReverseEngineeringStrategyTest.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/DefaultReverseEngineeringStrategyTest.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -106,11 +106,11 @@
}
public void testPreferredTypes() {
- assertEquals("int",rns.columnToHibernateTypeName(null, "bogus",Types.INTEGER,0,0,0, false));
- assertEquals("java.lang.Integer",rns.columnToHibernateTypeName(null, "bogus",Types.INTEGER,0,0,0, true));
- assertEquals("serializable",rns.columnToHibernateTypeName(new TableIdentifier("sdf"), "bogus",-567,0,0,0, false));
+ assertEquals("int",rns.columnToHibernateTypeName(null, "bogus",Types.INTEGER,0,0,0, false, false));
+ assertEquals("java.lang.Integer",rns.columnToHibernateTypeName(null, "bogus",Types.INTEGER,0,0,0, true, false));
+ assertEquals("serializable",rns.columnToHibernateTypeName(new TableIdentifier("sdf"), "bogus",-567,0,0,0, false, false));
- assertEquals("string",rns.columnToHibernateTypeName(new TableIdentifier("sdf"), "bogus",12,0,0,0, false));
+ assertEquals("string",rns.columnToHibernateTypeName(new TableIdentifier("sdf"), "bogus",12,0,0,0, false, false));
}
public void testReservedKeywordsHandling() {
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OverrideBinderTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OverrideBinderTest.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/OverrideBinderTest.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -49,23 +49,23 @@
or.addResource(TEST_REVENG_XML);
ReverseEngineeringStrategy repository = or.getReverseEngineeringStrategy(null);
- assertEquals("int", repository.columnToHibernateTypeName(null, null, Types.INTEGER, 5, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals("long", repository.columnToHibernateTypeName(null, null, Types.INTEGER, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals("byte[]", repository.columnToHibernateTypeName(null, null, Types.BIGINT, SQLTypeMapping.UNKNOWN_LENGTH, 5, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals("java.math.BigInteger", repository.columnToHibernateTypeName(null, null, Types.BIGINT, SQLTypeMapping.UNKNOWN_LENGTH, 2, 3, false) );
- assertEquals("string", repository.columnToHibernateTypeName(null, null, Types.CHAR, 1, 10, SQLTypeMapping.UNKNOWN_SCALE, false) );
+ assertEquals("int", repository.columnToHibernateTypeName(null, null, Types.INTEGER, 5, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals("long", repository.columnToHibernateTypeName(null, null, Types.INTEGER, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals("byte[]", repository.columnToHibernateTypeName(null, null, Types.BIGINT, SQLTypeMapping.UNKNOWN_LENGTH, 5, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals("java.math.BigInteger", repository.columnToHibernateTypeName(null, null, Types.BIGINT, SQLTypeMapping.UNKNOWN_LENGTH, 2, 3, false, false) );
+ assertEquals("string", repository.columnToHibernateTypeName(null, null, Types.CHAR, 1, 10, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
//assertEquals("string", repository.jdbcToHibernateType(Types.CHAR, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE) );
- assertEquals("Long", repository.columnToHibernateTypeName(null, null, Types.NUMERIC, 1, 10, 0, false) );
- assertEquals("java.lang.Long", repository.columnToHibernateTypeName(null, null, Types.NUMERIC, 1, 10, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals("java.lang.Long", repository.columnToHibernateTypeName(null, null, Types.NUMERIC, 1, 10, 43, false) );
+ assertEquals("Long", repository.columnToHibernateTypeName(null, null, Types.NUMERIC, 1, 10, 0, false, false) );
+ assertEquals("java.lang.Long", repository.columnToHibernateTypeName(null, null, Types.NUMERIC, 1, 10, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals("java.lang.Long", repository.columnToHibernateTypeName(null, null, Types.NUMERIC, 1, 10, 43, false, false) );
// nullability
- assertEquals("nonnull-float", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,17,false) );
- assertEquals("null-float", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,17,true) );
+ assertEquals("nonnull-float", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,17,false, false) );
+ assertEquals("null-float", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,17,true, false) );
- assertEquals("onlynotnull", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,SQLTypeMapping.UNKNOWN_SCALE,false) );
- assertEquals("donotcare", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,SQLTypeMapping.UNKNOWN_SCALE,true) );
+ assertEquals("onlynotnull", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,SQLTypeMapping.UNKNOWN_SCALE,false, false) );
+ assertEquals("donotcare", repository.columnToHibernateTypeName(null, null, Types.FLOAT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION,SQLTypeMapping.UNKNOWN_SCALE,true, false) );
}
@@ -76,12 +76,12 @@
or.addResource(DOC_REVENG_XML);
ReverseEngineeringStrategy repository = or.getReverseEngineeringStrategy(new DefaultReverseEngineeringStrategy());
- assertEquals("int", repository.columnToHibernateTypeName(null, "ID", Types.INTEGER, SQLTypeMapping.UNKNOWN_LENGTH, 10, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals("your.package.TrimStringUserType", repository.columnToHibernateTypeName(null, "NAME", Types.VARCHAR, 30, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, true) );
- assertEquals("char", repository.columnToHibernateTypeName(null, "INITIAL", Types.VARCHAR, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, true) );
- assertEquals("java.lang.Character", repository.columnToHibernateTypeName(null, "CODE", Types.VARCHAR, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals("big_decimal", repository.columnToHibernateTypeName(null, "SALARY", Types.NUMERIC, SQLTypeMapping.UNKNOWN_LENGTH, 15, SQLTypeMapping.UNKNOWN_SCALE, true) );
- assertEquals("java.lang.Long", repository.columnToHibernateTypeName(null, "AGE", Types.NUMERIC, SQLTypeMapping.UNKNOWN_LENGTH, 3, SQLTypeMapping.UNKNOWN_SCALE, true) );
+ assertEquals("int", repository.columnToHibernateTypeName(null, "ID", Types.INTEGER, SQLTypeMapping.UNKNOWN_LENGTH, 10, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals("your.package.TrimStringUserType", repository.columnToHibernateTypeName(null, "NAME", Types.VARCHAR, 30, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, true, false) );
+ assertEquals("char", repository.columnToHibernateTypeName(null, "INITIAL", Types.VARCHAR, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, true, false) );
+ assertEquals("java.lang.Character", repository.columnToHibernateTypeName(null, "CODE", Types.VARCHAR, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals("big_decimal", repository.columnToHibernateTypeName(null, "SALARY", Types.NUMERIC, SQLTypeMapping.UNKNOWN_LENGTH, 15, SQLTypeMapping.UNKNOWN_SCALE, true, false) );
+ assertEquals("java.lang.Long", repository.columnToHibernateTypeName(null, "AGE", Types.NUMERIC, SQLTypeMapping.UNKNOWN_LENGTH, 3, SQLTypeMapping.UNKNOWN_SCALE, true, false) );
}
@@ -138,9 +138,9 @@
or.addResource(OVERRIDETEST_REVENG_XML);
ReverseEngineeringStrategy repository = or.getReverseEngineeringStrategy(null);
- assertNull(repository.columnToHibernateTypeName(new TableIdentifier("blah"), "bogus",0,0,0,0, false));
- assertNull(repository.columnToHibernateTypeName(new TableIdentifier("ORDERS"), "CUSTID",0,0,0,0, false));
- assertEquals("string", repository.columnToHibernateTypeName(new TableIdentifier(null, null, "ORDERS"), "NAME",0,0,0,0, false));
+ assertNull(repository.columnToHibernateTypeName(new TableIdentifier("blah"), "bogus",0,0,0,0, false, false));
+ assertNull(repository.columnToHibernateTypeName(new TableIdentifier("ORDERS"), "CUSTID",0,0,0,0, false, false));
+ assertEquals("string", repository.columnToHibernateTypeName(new TableIdentifier(null, null, "ORDERS"), "NAME",0,0,0,0, false, false));
PersistentClass classMapping = cfg.getClassMapping("Orders");
@@ -149,6 +149,13 @@
property = classMapping.getProperty("verified");
assertEquals("java.lang.Boolean because of null","java.lang.Boolean", ((SimpleValue)property.getValue()).getTypeName());
+
+ classMapping = cfg.getClassMapping("MiscTypes");
+
+ property = classMapping.getIdentifierProperty();
+
+ assertFalse(((SimpleValue)property.getValue()).isNullable());
+ assertEquals("java.lang.Long because of primary key", "java.lang.Long", ((SimpleValue)property.getValue()).getTypeName());
}
public void testColumnPropertyNameMappings() {
@@ -168,13 +175,17 @@
or.addResource(OVERRIDETEST_REVENG_XML);
ReverseEngineeringStrategy repository = or.getReverseEngineeringStrategy(null);
+ TableIdentifier miscTable = new TableIdentifier(null,null, "MISC_TYPES");
+ assertEquals("sequence",repository.getTableIdentifierStrategyName(miscTable));
+ Map props = repository.getTableIdentifierProperties(miscTable);
+ assertEquals("seq_table", props.get("table"));
+
assertNull(repository.getTableIdentifierStrategyName(new TableIdentifier("blah")));
assertNull(repository.getTableIdentifierProperties(new TableIdentifier("blah")));
TableIdentifier ordersTable = new TableIdentifier(null,null, "ORDERS");
- assertEquals("sequence",repository.getTableIdentifierStrategyName(ordersTable));
- Map props = repository.getTableIdentifierProperties(ordersTable);
- assertEquals("seq_table", props.get("table"));
+
+
assertEquals("customOrderId", repository.tableToIdentifierPropertyName(ordersTable));
assertEquals(null, repository.tableToIdentifierPropertyName(new TableIdentifier("blah")));
@@ -193,17 +204,22 @@
// applied
PersistentClass classMapping = cfg.getClassMapping("Orders");
- Component sv = (Component) classMapping.getIdentifier();
- assertEquals("CustomOID", sv.getComponentClassName());
- assertEquals("sequence", sv.getIdentifierGeneratorStrategy()); // will fail if default schema is not set since then there is no match in the override binder
+ SimpleValue sv = (SimpleValue) classMapping.getIdentifier();
+ assertEquals("CustomOID", ((Component)sv).getComponentClassName());
+ assertEquals(2,classMapping.getIdentifierProperty().getColumnSpan());
+
+ Property identifierProperty = classMapping.getIdentifierProperty();
+ assertEquals("customOrderId", identifierProperty.getName());
+
+ classMapping = cfg.getClassMapping("MiscTypes");
+ sv = (SimpleValue) classMapping.getIdentifier();
+ assertEquals("sequence", sv.getIdentifierGeneratorStrategy()); // will fail if default schema is not set since then there is no match in the override binder
+
assertNotNull(sv.getIdentifierGeneratorProperties());
assertEquals("seq_table", sv.getIdentifierGeneratorProperties().getProperty("table"));
- assertEquals(2,classMapping.getIdentifierProperty().getColumnSpan());
- Property identifierProperty = classMapping.getIdentifierProperty();
- assertEquals("customOrderId", identifierProperty.getName());
}
@@ -303,9 +319,9 @@
or.addTypeMapping(sqltype);
ReverseEngineeringStrategy res = or.getReverseEngineeringStrategy(null);
- assertEquals("boolean",res.columnToHibernateTypeName(null,null, Types.BINARY, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals(null,res.columnToHibernateTypeName(null,null, Types.LONGVARCHAR, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false) );
- assertEquals("yes_no",res.columnToHibernateTypeName(null,null, Types.BIT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false) );
+ assertEquals("boolean",res.columnToHibernateTypeName(null,null, Types.BINARY, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals(null,res.columnToHibernateTypeName(null,null, Types.LONGVARCHAR, 1, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
+ assertEquals("yes_no",res.columnToHibernateTypeName(null,null, Types.BIT, SQLTypeMapping.UNKNOWN_LENGTH, SQLTypeMapping.UNKNOWN_PRECISION, SQLTypeMapping.UNKNOWN_SCALE, false, false) );
}
public void testTableExclude() {
@@ -384,7 +400,7 @@
PersistentClass classMapping = cfg.getClassMapping("MiscTypes");
- assertEquals("long", getPropertyTypeName(classMapping.getIdentifierProperty() ) );
+
assertEquals("SomeUserType", getPropertyTypeName(classMapping.getProperty("name") ) );
assertEquals("string", getPropertyTypeName(classMapping.getProperty("shortname") ) );
assertEquals("yes_no", getPropertyTypeName(classMapping.getProperty("flag") ) );
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/test/jdbc2cfg/overridetest.reveng.xml 2006-03-31 15:41:05 UTC (rev 9723)
@@ -46,9 +46,6 @@
-->
<table name="ORDERS">
<primary-key property="customOrderId" composite-id-class="CustomOID">
- <generator class="sequence">
- <param name="table">seq_table</param>
- </generator>
<!-- <column name="CUSTID" foreign-table="CUSTOMER" foreign-column="CUSTID" /> -->
<key-column name="ORDERID"/>
<key-column name="CUSTID"/>
@@ -60,7 +57,14 @@
</foreign-key>
</table>
-
+ <table name="MISC_TYPES">
+ <primary-key>
+ <generator class="sequence">
+ <param name="table">seq_table</param>
+ </generator>
+ </primary-key>
+ </table>
+
<table name="CHILDREN">
<foreign-key constraint-name="child_to_parent" foreign-table="PARENT">
<column-ref local-column="parentid" foreign-column="id" />
Modified: trunk/HibernateExt/tools/src/testsupport/NoopReverseEngineeringStrategy.java
===================================================================
--- trunk/HibernateExt/tools/src/testsupport/NoopReverseEngineeringStrategy.java 2006-03-31 14:26:37 UTC (rev 9722)
+++ trunk/HibernateExt/tools/src/testsupport/NoopReverseEngineeringStrategy.java 2006-03-31 15:41:05 UTC (rev 9723)
@@ -40,7 +40,7 @@
return false;
}
- public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable) {
+ public String columnToHibernateTypeName(TableIdentifier table, String columnName, int sqlType, int length, int precision, int scale, boolean nullable, boolean generatedIdentifier) {
// TODO Auto-generated method stub
return null;
}
|
|
From: <hib...@li...> - 2006-03-31 14:26:43
|
Author: max...@jb... Date: 2006-03-31 09:26:37 -0500 (Fri, 31 Mar 2006) New Revision: 9722 Modified: trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd Log: remove not yet support syntax in dtd Modified: trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd =================================================================== --- trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd 2006-03-31 00:26:43 UTC (rev 9721) +++ trunk/HibernateExt/tools/src/java/org/hibernate/hibernate-reverse-engineering-3.0.dtd 2006-03-31 14:26:37 UTC (rev 9722) @@ -83,13 +83,11 @@ <!ELEMENT param (#PCDATA)> <!ATTLIST param name CDATA #REQUIRED> -<!ELEMENT foreign-key (column-ref+,many-to-one?,(set|bag)?) > +<!ELEMENT foreign-key (column-ref+,many-to-one?,(set)?) > <!ATTLIST foreign-key constraint-name CDATA #IMPLIED > <!ATTLIST foreign-key foreign-catalog CDATA #IMPLIED > <!ATTLIST foreign-key foreign-schema CDATA #IMPLIED > <!ATTLIST foreign-key foreign-table CDATA #REQUIRED > -<!--<!ATTLIST foreign-key cardinality (many-to-one|one-to-many) #REQUIRED > -<!ATTLIST foreign-key direction (bi|uni|none) #REQUIRED > --> <!ELEMENT column-ref EMPTY > <!ATTLIST column-ref local-column CDATA #REQUIRED > @@ -101,8 +99,8 @@ <!ELEMENT set EMPTY > <!ATTLIST set property CDATA #REQUIRED> -<!ELEMENT bag EMPTY > -<!ATTLIST bag property CDATA #REQUIRED> +<!-- <!ELEMENT bag EMPTY > +<!ATTLIST bag property CDATA #REQUIRED> --> <!-- a table-filter allows to explicitly exclude or include tables or complete catalog/schemas into the reverse engineering --> <!ELEMENT table-filter EMPTY > |
|
From: <hib...@li...> - 2006-03-31 00:27:12
|
Author: epbernard
Date: 2006-03-30 19:26:43 -0500 (Thu, 30 Mar 2006)
New Revision: 9721
Modified:
trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java
Log:
ANN-295
ANN-296
Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-03-31 00:11:54 UTC (rev 9720)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-03-31 00:26:43 UTC (rev 9721)
@@ -94,6 +94,7 @@
import org.hibernate.id.MultipleHiLoPerTableGenerator;
import org.hibernate.id.PersistentIdentifierGenerator;
import org.hibernate.id.TableHiLoGenerator;
+import org.hibernate.id.SequenceHiLoGenerator;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.DependantValue;
import org.hibernate.mapping.IdGenerator;
@@ -273,23 +274,24 @@
if ( !isDefault( tabGen.pkColumnValue() ) ) {
idGen.addParam( MultipleHiLoPerTableGenerator.PK_VALUE_NAME, tabGen.pkColumnValue() );
}
- idGen.addParam( TableHiLoGenerator.MAX_LO, String.valueOf( tabGen.allocationSize() ) );
+ idGen.addParam( TableHiLoGenerator.MAX_LO, String.valueOf( tabGen.allocationSize() - 1 ) );
log.debug( "Add table generator with name: " + idGen.getName() );
}
else if ( ann instanceof SequenceGenerator ) {
SequenceGenerator seqGen = (SequenceGenerator) ann;
idGen.setName( seqGen.name() );
- idGen.setIdentifierGeneratorStrategy( "sequence" );
+ idGen.setIdentifierGeneratorStrategy( "seqhilo" );
if ( ! isDefault( seqGen.sequenceName() ) ) {
idGen.addParam( org.hibernate.id.SequenceGenerator.SEQUENCE, seqGen.sequenceName() );
}
//FIXME: work on initialValue() and allocationSize() through SequenceGenerator.PARAMETERS
- if ( seqGen.initialValue() != 0 || seqGen.allocationSize() != 50 ) {
+ if ( seqGen.initialValue() != 0 ) {
log.warn(
- "Hibernate does not support SequenceGenerator.initialValue() nor SequenceGenerator.allocationSize()"
+ "Hibernate does not support SequenceGenerator.initialValue()"
);
}
+ idGen.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( seqGen.allocationSize() - 1 ) );
log.debug( "Add sequence generator with name: " + idGen.getName() );
}
else if ( ann instanceof GenericGenerator ) {
@@ -1559,7 +1561,7 @@
//yuk! this is a hack not to override 'AUTO' even if generator is set
final boolean avoidOverriding =
identifierGeneratorStrategy.equals( "identity" )
- || identifierGeneratorStrategy.equals( "sequence" )
+ || identifierGeneratorStrategy.equals( "seqhilo" )
|| identifierGeneratorStrategy.equals( MultipleHiLoPerTableGenerator.class.getName() );
if ( ! avoidOverriding ) {
id.setIdentifierGeneratorStrategy( identifierGeneratorStrategy );
@@ -1738,7 +1740,7 @@
case TABLE:
return MultipleHiLoPerTableGenerator.class.getName();
case SEQUENCE:
- return "sequence";
+ return "seqhilo";
}
throw new AssertionFailure( "Unknown GeneratorType: " + generatorEnum );
}
|
|
From: <hib...@li...> - 2006-03-31 00:13:17
|
Author: epbernard
Date: 2006-03-30 19:11:54 -0500 (Thu, 30 Mar 2006)
New Revision: 9720
Modified:
trunk/Hibernate3/src/org/hibernate/id/MultipleHiLoPerTableGenerator.java
trunk/Hibernate3/src/org/hibernate/id/SequenceHiLoGenerator.java
trunk/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java
trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java
Log:
HHH-1620
Modified: trunk/Hibernate3/src/org/hibernate/id/MultipleHiLoPerTableGenerator.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/id/MultipleHiLoPerTableGenerator.java 2006-03-30 23:13:56 UTC (rev 9719)
+++ trunk/Hibernate3/src/org/hibernate/id/MultipleHiLoPerTableGenerator.java 2006-03-31 00:11:54 UTC (rev 9720)
@@ -179,13 +179,18 @@
public synchronized Serializable generate(SessionImplementor session, Object obj)
throws HibernateException {
+ if (maxLo < 1) {
+ //keep the behavior consistent even for boundary usages
+ int val = ( (Integer) doWorkInNewTransaction(session) ).intValue();
+ if (val == 0) val = ( (Integer) doWorkInNewTransaction(session) ).intValue();
+ return IdentifierGeneratorFactory.createNumber( val, returnClass );
+ }
if (lo>maxLo) {
int hival = ( (Integer) doWorkInNewTransaction(session) ).intValue();
lo = (hival == 0) ? 1 : 0;
hi = hival * (maxLo+1);
log.debug("new hi value: " + hival);
}
-
return IdentifierGeneratorFactory.createNumber( hi + lo++, returnClass );
}
Modified: trunk/Hibernate3/src/org/hibernate/id/SequenceHiLoGenerator.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/id/SequenceHiLoGenerator.java 2006-03-30 23:13:56 UTC (rev 9719)
+++ trunk/Hibernate3/src/org/hibernate/id/SequenceHiLoGenerator.java 2006-03-31 00:11:54 UTC (rev 9720)
@@ -48,7 +48,12 @@
public synchronized Serializable generate(SessionImplementor session, Object obj)
throws HibernateException {
-
+ if (maxLo < 1) {
+ //keep the behavior consistent even for boundary usages
+ long val = ( (Number) super.generate(session, obj) ).longValue();
+ if (val == 0) val = ( (Number) super.generate(session, obj) ).longValue();
+ return IdentifierGeneratorFactory.createNumber( val, returnClass );
+ }
if ( lo>maxLo ) {
long hival = ( (Number) super.generate(session, obj) ).longValue();
lo = (hival == 0) ? 1 : 0;
Modified: trunk/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java 2006-03-30 23:13:56 UTC (rev 9719)
+++ trunk/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java 2006-03-31 00:11:54 UTC (rev 9720)
@@ -52,7 +52,7 @@
public synchronized Serializable generate(SessionImplementor session, Object obj)
throws HibernateException {
- if (maxLo < 2) {
+ if (maxLo < 1) {
//keep the behavior consistent even for boundary usages
int val = ( (Integer) super.generate(session, obj) ).intValue();
return IdentifierGeneratorFactory.createNumber( val, returnClass );
Modified: trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml 2006-03-30 23:13:56 UTC (rev 9719)
+++ trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml 2006-03-31 00:11:54 UTC (rev 9720)
@@ -16,7 +16,7 @@
<id name="id">
<generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
- <param name="max_lo">1</param>
+ <param name="max_lo">0</param>
</generator>
</id>
<property name="color"/>
Modified: trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java 2006-03-30 23:13:56 UTC (rev 9719)
+++ trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java 2006-03-31 00:11:54 UTC (rev 9720)
@@ -26,7 +26,7 @@
public void testDistinctId() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
- int testLength = 5;
+ int testLength = 8;
Car[] cars = new Car[testLength];
Plane[] planes = new Plane[testLength];
for (int i = 0; i < testLength ; i++) {
@@ -35,13 +35,13 @@
planes[i] = new Plane();
planes[i].setNbrOfSeats(i);
s.persist(cars[i]);
- s.persist(planes[i]);
+ //s.persist(planes[i]);
}
tx.commit();
s.close();
for (int i = 0; i < testLength ; i++) {
assertEquals(i+1, cars[i].getId().intValue());
- assertEquals(i+1, planes[i].getId().intValue());
+ //assertEquals(i+1, planes[i].getId().intValue());
}
}
|
|
From: <hib...@li...> - 2006-03-30 23:14:36
|
Author: epbernard
Date: 2006-03-30 18:13:56 -0500 (Thu, 30 Mar 2006)
New Revision: 9719
Modified:
trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java
Log:
minor
Modified: trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml 2006-03-29 17:07:17 UTC (rev 9718)
+++ trunk/Hibernate3/test/org/hibernate/test/id/Car.hbm.xml 2006-03-30 23:13:56 UTC (rev 9719)
@@ -16,7 +16,7 @@
<id name="id">
<generator class="org.hibernate.id.MultipleHiLoPerTableGenerator">
- <param name="max_lo">2</param>
+ <param name="max_lo">1</param>
</generator>
</id>
<property name="color"/>
Modified: trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java 2006-03-29 17:07:17 UTC (rev 9718)
+++ trunk/Hibernate3/test/org/hibernate/test/id/MultipleHiLoPerTableGeneratorTest.java 2006-03-30 23:13:56 UTC (rev 9719)
@@ -26,7 +26,7 @@
public void testDistinctId() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
- int testLength = 3;
+ int testLength = 5;
Car[] cars = new Car[testLength];
Plane[] planes = new Plane[testLength];
for (int i = 0; i < testLength ; i++) {
|
|
From: <hib...@li...> - 2006-03-29 17:07:23
|
Author: max...@jb...
Date: 2006-03-29 12:07:17 -0500 (Wed, 29 Mar 2006)
New Revision: 9718
Modified:
trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Basic.hbm.xml
Log:
whoops
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Basic.hbm.xml
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Basic.hbm.xml 2006-03-29 16:26:46 UTC (rev 9717)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Basic.hbm.xml 2006-03-29 17:07:17 UTC (rev 9718)
@@ -14,7 +14,7 @@
<id name="basicId"
length="10"
-
+ type="string"
unsaved-value="null"
>
<generator class="org.hibernate.id.TableHiLoGenerator">
|
Author: epbernard
Date: 2006-03-29 11:26:46 -0500 (Wed, 29 Mar 2006)
New Revision: 9717
Added:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/util/ConfigurationHelper.java
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/ops/MergeNewTest.java
Log:
EJB-155
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-03-29 16:07:12 UTC (rev 9716)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-03-29 16:26:46 UTC (rev 9717)
@@ -49,6 +49,7 @@
import org.hibernate.ejb.packaging.PersistenceXmlLoader;
import org.hibernate.ejb.transaction.JoinableCMTTransactionFactory;
import org.hibernate.ejb.util.LogHelper;
+import org.hibernate.ejb.util.ConfigurationHelper;
import org.hibernate.engine.FilterDefinition;
import org.hibernate.event.EventListeners;
import org.hibernate.mapping.AuxiliaryDatabaseObject;
@@ -270,11 +271,7 @@
Properties properties = info.getProperties() != null ?
info.getProperties() :
new Properties();
- for ( Map.Entry entry : (Set<Map.Entry>) integration.entrySet() ) {
- if ( entry.getKey() instanceof String && entry.getValue() instanceof String ) {
- properties.setProperty( (String) entry.getKey(), (String) entry.getValue() );
- }
- }
+ ConfigurationHelper.overrideProperties( properties, integration );
//FIXME send the appropriate entites.
if ( "true".equalsIgnoreCase( properties.getProperty(HibernatePersistence.USE_CLASS_ENHANCER) ) ) {
@@ -319,7 +316,7 @@
private void defineTransactionType(Object overridenTxType, String persistenceUnitName) {
if (overridenTxType == null) {
if (transactionType == null) {
- transactionType = PersistenceUnitTransactionType.JTA; //this is the default value
+ transactionType = PersistenceUnitTransactionType.JTA; //this is the default value
}
}
else if (overridenTxType instanceof String) {
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2006-03-29 16:07:12 UTC (rev 9716)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2006-03-29 16:26:46 UTC (rev 9717)
@@ -7,7 +7,6 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import javax.persistence.PersistenceException;
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.xml.parsers.DocumentBuilder;
@@ -17,6 +16,7 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.cfg.EJB3DTDEntityResolver;
import org.hibernate.ejb.HibernatePersistence;
+import org.hibernate.ejb.util.ConfigurationHelper;
import org.hibernate.util.StringHelper;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -98,11 +98,7 @@
metadata.setNonJtaDatasource( dataSource );
}
Properties properties = metadata.getProps();
- for ( Map.Entry entry : (Set<Map.Entry>) overrides.entrySet() ) {
- if ( entry.getKey() instanceof String && entry.getValue() instanceof String ) {
- properties.setProperty( (String) entry.getKey(), (String) entry.getValue() );
- }
- }
+ ConfigurationHelper.overrideProperties( properties, overrides );
units.add( metadata );
}
}
Added: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/util/ConfigurationHelper.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/util/ConfigurationHelper.java 2006-03-29 16:07:12 UTC (rev 9716)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/util/ConfigurationHelper.java 2006-03-29 16:26:46 UTC (rev 9717)
@@ -0,0 +1,19 @@
+//$Id: $
+package org.hibernate.ejb.util;
+
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public abstract class ConfigurationHelper {
+ public static void overrideProperties(Properties properties, Map overrides) {
+ for ( Map.Entry entry : (Set<Map.Entry>) overrides.entrySet() ) {
+ if ( entry.getKey() instanceof String && entry.getValue() instanceof String ) {
+ properties.setProperty( (String) entry.getKey(), (String) entry.getValue() );
+ }
+ }
+ }
+}
Modified: trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/ops/MergeNewTest.java
===================================================================
--- trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/ops/MergeNewTest.java 2006-03-29 16:07:12 UTC (rev 9716)
+++ trunk/HibernateExt/ejb/src/test/org/hibernate/ejb/test/ops/MergeNewTest.java 2006-03-29 16:26:46 UTC (rev 9717)
@@ -24,6 +24,31 @@
em.close();
}
+ public void testMergeAfterRemove() throws Exception {
+ Workload load = new Workload();
+ load.name = "Cleaning";
+ load.load = 10;
+ EntityManager em = factory.createEntityManager();
+ em.getTransaction().begin();
+ load = em.merge( load );
+ em.flush();
+ em.getTransaction().commit();
+ em.close();
+ em = factory.createEntityManager();
+ em.getTransaction().begin();
+ load = em.find(Workload.class, load.id);
+ em.remove( load );
+ em.flush();
+ em.getTransaction().commit();
+ em.close();
+ em = factory.createEntityManager();
+ em.getTransaction().begin();
+ em.merge( load );
+ em.flush();
+ em.getTransaction().commit();
+ em.close();
+ }
+
public Class[] getAnnotatedClasses() {
return new Class[] {
Workload.class
|
|
From: <hib...@li...> - 2006-03-29 16:07:28
|
Author: max...@jb...
Date: 2006-03-29 11:07:12 -0500 (Wed, 29 Mar 2006)
New Revision: 9716
Added:
trunk/HibernateExt/tools/lib/testlibs/hibernate-entitymanager.jar
trunk/HibernateExt/tools/lib/testlibs/javassist.jar
trunk/HibernateExt/tools/lib/testlibs/jboss-archive-browsing.jar
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/EJB3ConfigurationTask.java
trunk/HibernateExt/tools/src/testsupport/ejb3test-hibernate.cfg.xml
trunk/HibernateExt/tools/src/testsupport/ejb3test-persistence.xml
Log:
HBX-632 Provide <ejb3configuration> support in Ant
Added: trunk/HibernateExt/tools/lib/testlibs/hibernate-entitymanager.jar
===================================================================
(Binary files differ)
Property changes on: trunk/HibernateExt/tools/lib/testlibs/hibernate-entitymanager.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/HibernateExt/tools/lib/testlibs/javassist.jar
===================================================================
(Binary files differ)
Property changes on: trunk/HibernateExt/tools/lib/testlibs/javassist.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/HibernateExt/tools/lib/testlibs/jboss-archive-browsing.jar
===================================================================
(Binary files differ)
Property changes on: trunk/HibernateExt/tools/lib/testlibs/jboss-archive-browsing.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/EJB3ConfigurationTask.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/EJB3ConfigurationTask.java 2006-03-29 15:58:38 UTC (rev 9715)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/EJB3ConfigurationTask.java 2006-03-29 16:07:12 UTC (rev 9716)
@@ -0,0 +1,62 @@
+package org.hibernate.tool.ant;
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+import org.hibernate.HibernateException;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.util.ReflectHelper;
+
+public class EJB3ConfigurationTask extends ConfigurationTask {
+
+ public EJB3ConfigurationTask() {
+ setDescription("EJB3 Configuration");
+ }
+
+ protected Configuration createConfiguration() {
+ try {
+ Map overrides = new HashMap();
+ // set to avoid complain: "The chosen transaction strategy requires access to the JTA TransactionManager "
+ //overrides.put("javax.persistence.transactionType", "RESOURCE_LOCAL");
+
+ Class clazz = ReflectHelper.classForName("org.hibernate.ejb.Ejb3Configuration", EJB3ConfigurationTask.class);
+ Object ejb3cfg = clazz.newInstance();
+ Method method = clazz.getMethod("createEntityManagerFactory", new Class[] { String.class, Map.class });
+ method.invoke(ejb3cfg, new Object[] { null, overrides } );
+
+ method = clazz.getMethod("getHibernateConfiguration", new Class[0]);
+ return (Configuration) method.invoke(ejb3cfg, null);
+ }
+ catch(HibernateException he) {
+ throw new BuildException(he);
+ }
+ catch(Throwable t) {
+ throw new BuildException("Problems in creating a Ejb3Configuration. Have you remembered to add it to the classpath ?",t);
+ }
+
+ }
+
+ protected void doConfiguration(Configuration configuration) {
+ }
+
+ protected void validateParameters() throws BuildException {
+
+ }
+
+ public void setConfigurationFile(File configurationFile) {
+ complain("configurationfile");
+ }
+
+ public void setEntityResolver(String entityResolverName) {
+ complain("entityresolver");
+ }
+
+ private void complain(String param) {
+ throw new BuildException("ejb3configuration currently only support autodiscovery from META-INF/persistence.xml. Thus setting the " + param + " attribute is not allowed");
+ }
+
+
+}
Added: trunk/HibernateExt/tools/src/testsupport/ejb3test-hibernate.cfg.xml
===================================================================
--- trunk/HibernateExt/tools/src/testsupport/ejb3test-hibernate.cfg.xml 2006-03-29 15:58:38 UTC (rev 9715)
+++ trunk/HibernateExt/tools/src/testsupport/ejb3test-hibernate.cfg.xml 2006-03-29 16:07:12 UTC (rev 9716)
@@ -0,0 +1,9 @@
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+ <property name="show_sql">true</property>
+ </session-factory>
+</hibernate-configuration>
\ No newline at end of file
Added: trunk/HibernateExt/tools/src/testsupport/ejb3test-persistence.xml
===================================================================
--- trunk/HibernateExt/tools/src/testsupport/ejb3test-persistence.xml 2006-03-29 15:58:38 UTC (rev 9715)
+++ trunk/HibernateExt/tools/src/testsupport/ejb3test-persistence.xml 2006-03-29 16:07:12 UTC (rev 9716)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- example of reference to a cfg.xml file -->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="ejb3test" transaction-type="RESOURCE_LOCAL">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <properties>
+ <property name="hibernate.ejb.cfgfile" value="/ejb3test-hibernate.cfg.xml"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
+ </properties>
+ </persistence-unit>
+</persistence>
\ No newline at end of file
|
|
From: <hib...@li...> - 2006-03-29 15:59:24
|
Author: max...@jb...
Date: 2006-03-29 10:58:38 -0500 (Wed, 29 Mar 2006)
New Revision: 9715
Modified:
trunk/HibernateExt/tools/lib/testlibs/ejb3-persistence.jar
trunk/HibernateExt/tools/lib/testlibs/hibernate-annotations.jar
trunk/HibernateExt/tools/lib/testlibs/hibernate3.jar
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/Hbm2DDLExporterTask.java
trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/BuildFileTestCase.java
trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java
trunk/HibernateExt/tools/src/testsupport/anttest-build.xml
Log:
HBX-632 Provide <ejb3configuration> support in Ant
Modified: trunk/HibernateExt/tools/lib/testlibs/ejb3-persistence.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/tools/lib/testlibs/hibernate-annotations.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/tools/lib/testlibs/hibernate3.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/Hbm2DDLExporterTask.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/Hbm2DDLExporterTask.java 2006-03-29 14:35:31 UTC (rev 9714)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/Hbm2DDLExporterTask.java 2006-03-29 15:58:38 UTC (rev 9715)
@@ -5,6 +5,8 @@
package org.hibernate.tool.ant;
import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.Iterator;
import org.apache.tools.ant.BuildException;
@@ -61,7 +63,11 @@
parent.log(export.getExceptions().size() + " errors occurred while performing <hbm2ddl>.", Project.MSG_WARN);
while ( iterator.hasNext() ) {
Throwable throwable = (Throwable) iterator.next();
- parent.log("Error #" + cnt + ": " + throwable.toString(), Project.MSG_WARN);
+ parent.log("Error #" + cnt + ": " + throwable.toString(), Project.MSG_WARN);
+ StringWriter sw = new StringWriter();
+ throwable.printStackTrace(new PrintWriter(sw));
+ parent.log(sw.getBuffer().toString(), Project.MSG_VERBOSE);
+
}
if(haltOnError) {
throw new BuildException("Errors while performing <hbm2ddl>");
Modified: trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java
===================================================================
--- trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-03-29 14:35:31 UTC (rev 9714)
+++ trunk/HibernateExt/tools/src/java/org/hibernate/tool/ant/HibernateToolTask.java 2006-03-29 15:58:38 UTC (rev 9715)
@@ -58,6 +58,12 @@
return (AnnotationConfigurationTask) configurationTask;
}
+ public EJB3ConfigurationTask createEjb3Configuration() {
+ checkConfiguration();
+ configurationTask = new EJB3ConfigurationTask();
+ return (EJB3ConfigurationTask) configurationTask;
+ }
+
public ExporterTask createHbm2DDL() {
ExporterTask generator = new Hbm2DDLExporterTask(this);
generators.add(generator);
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/BuildFileTestCase.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/BuildFileTestCase.java 2006-03-29 14:35:31 UTC (rev 9714)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/BuildFileTestCase.java 2006-03-29 15:58:38 UTC (rev 9715)
@@ -237,7 +237,7 @@
System.setErr(err);
logBuffer = new StringBuffer();
fullLogBuffer = new StringBuffer();
- buildException = null;
+ buildException = null;
project.executeTarget(targetName);
}
catch (BuildException be) {
Modified: trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java
===================================================================
--- trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java 2006-03-29 14:35:31 UTC (rev 9714)
+++ trunk/HibernateExt/tools/src/test/org/hibernate/tool/ant/HibernateToolTest.java 2006-03-29 15:58:38 UTC (rev 9715)
@@ -61,6 +61,15 @@
executeTarget("testantannotationcfg");
}
+ public void testEJB3ConfigurationFailureExpected() {
+ executeTarget("testantejb3cfg");
+ File baseDir = new File(project.getProperty("build.dir"));
+ File ejb3 = new File(baseDir, "ejb3.sql");
+
+ assertTrue(ejb3.exists());
+ assertEquals(null, TestHelper.findFirstString("drop", ejb3));
+ }
+
public void testHbm2JavaConfiguration() {
executeTarget("testanthbm2java");
}
Modified: trunk/HibernateExt/tools/src/testsupport/anttest-build.xml
===================================================================
--- trunk/HibernateExt/tools/src/testsupport/anttest-build.xml 2006-03-29 14:35:31 UTC (rev 9714)
+++ trunk/HibernateExt/tools/src/testsupport/anttest-build.xml 2006-03-29 15:58:38 UTC (rev 9715)
@@ -1,55 +1,54 @@
<project name="anttest">
- <property name="hibernate-core.jar" location="../../../../hibernate-3.1/hibernate3.jar"/>
- <property name="hibernate-core.home" location="../../../../hibernate3"/>
- <property name="hibernate-core.lib.dir" location="${hibernate-core.home}/lib"/>
- <property name="build.dir" location="../../build/anttest"/>
- <property file="../../etc/hibernate.properties"/>
+ <property name="hibernate-core.jar" location="../../../../hibernate-3.1/hibernate3.jar" />
+ <property name="hibernate-core.home" location="../../../../hibernate3" />
+ <property name="hibernate-core.lib.dir" location="${hibernate-core.home}/lib" />
+ <property name="build.dir" location="../../build/anttest" />
+ <property file="../../etc/hibernate.properties" />
- <delete dir="${build.dir}"/>
- <path id="tasks.classpath">
- <pathelement path="../../build/eclipse"/>
- <pathelement path="../../build/classes"/>
+ <path id="tasks.classpath">
+ <pathelement path="../../build/eclipse" />
+ <pathelement path="../../build/classes" />
- <fileset dir="${hibernate-core.lib.dir}">
- <include name="**/*.jar"/>
- </fileset>
-
- <pathelement location="${hibernate-core.jar}"/>
- <pathelement path="../../lib/freemarker.jar"/>
- <pathelement path="${hibernate-core.home}\jdbc\hsqldb.jar"/>
- </path>
+ <fileset dir="${hibernate-core.lib.dir}">
+ <include name="**/*.jar" />
+ </fileset>
-
-<target name="testantcfg">
-
- <mkdir dir="build/testsupport"/>
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
- <hibernatetool destdir="${build.dir}/topdown">
- <classpath>
- <path location="../../build/testsupport"/>
- </classpath>
-
- <configuration namingstrategy="org.hibernate.cfg.ImprovedNamingStrategy" entityresolver="DummyEntityResolver">
- <fileset dir="../test" id="id">
- <include name="**/*TopDown.hbm.xml"/>
- </fileset>
- </configuration>
-
- <hbm2java/>
- <hbm2ddl drop="false" create="true" export="false" outputfilename="onlycreate.sql" format="true"/>
- <hbm2ddl drop="true" create="false" export="false" outputfilename="onlydrop.sql" format="true"/>
- <hbm2ddl drop="true" create="true" export="false" outputfilename="dropandcreate.sql" format="true"/>
- <hbm2doc/>
- </hibernatetool>
-
-</target>
+ <pathelement location="${hibernate-core.jar}" />
+ <pathelement path="../../lib/freemarker.jar" />
+ <pathelement path="${hibernate-core.home}\jdbc\hsqldb.jar" />
+ </path>
-<target name="testantjdbccfg">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
- <property file="../etc/hibernate.properties" prefix="tools"/>
-<!--
+
+ <target name="testantcfg">
+
+ <mkdir dir="build/testsupport" />
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" />
+ <hibernatetool destdir="${build.dir}/topdown">
+ <classpath>
+ <path location="../../build/testsupport" />
+ </classpath>
+
+ <configuration namingstrategy="org.hibernate.cfg.ImprovedNamingStrategy" entityresolver="DummyEntityResolver">
+ <fileset dir="../test" id="id">
+ <include name="**/*TopDown.hbm.xml" />
+ </fileset>
+ </configuration>
+
+ <hbm2java />
+ <hbm2ddl drop="false" create="true" export="false" outputfilename="onlycreate.sql" format="true" />
+ <hbm2ddl drop="true" create="false" export="false" outputfilename="onlydrop.sql" format="true" />
+ <hbm2ddl drop="true" create="true" export="false" outputfilename="dropandcreate.sql" format="true" />
+ <hbm2doc />
+ </hibernatetool>
+
+ </target>
+
+ <target name="testantjdbccfg">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+ <property file="../etc/hibernate.properties" prefix="tools" />
+ <!--
<sql onerror="continue" driver="${tools.hibernate.connection.driver_class}" password="${tools.hibernate.connection.password}" url="${tools.hibernate.connection.url}" userid="${tools.hibernate.connection.username}" classpath="C:\work\products\hsqldb-1.7.2.6\lib\hsqldb.jar">
create table BottomUp (
id bigint not null,
@@ -57,243 +56,277 @@
primary key (id)
)
</sql> -->
- <hibernatetool destdir="${build.dir}/bottomup">
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties"/>
-
- <hbm2java/>
- <hbm2java templatepath="templates"/>
- <hbm2cfgxml/>
- </hibernatetool>
-</target>
+ <hibernatetool destdir="${build.dir}/bottomup">
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" />
- <target name="testantjdbccfgoverrides">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
- <property file="../etc/hibernate.properties" prefix="tools"/>
- <!-- <sql onerror="continue" driver="${tools.hibernate.connection.driver_class}" password="${tools.hibernate.connection.password}" url="${tools.hibernate.connection.url}" userid="${tools.hibernate.connection.username}" classpath="C:\work\products\hsqldb-1.7.2.6\lib\hsqldb.jar">
+ <hbm2java />
+ <hbm2java templatepath="templates" />
+ <hbm2cfgxml />
+ </hibernatetool>
+ </target>
+
+ <target name="testantjdbccfgoverrides">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+ <property file="../etc/hibernate.properties" prefix="tools" />
+ <!-- <sql onerror="continue" driver="${tools.hibernate.connection.driver_class}" password="${tools.hibernate.connection.password}" url="${tools.hibernate.connection.url}" userid="${tools.hibernate.connection.username}" classpath="C:\work\products\hsqldb-1.7.2.6\lib\hsqldb.jar">
create table BottomUp (
id bigint not null,
name varchar(255),
primary key (id)
)
</sql> -->
- <hibernatetool destdir="${build.dir}/bottomupoverride">
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packagename="test" revengfile="hibernate.reveng.xml"/>
-
- <hbm2java/>
- </hibernatetool>
- </target>
-
-<target name="testanthbm2java">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
- <hibernatetool destdir="${build.dir}/bottomup">
- <configuration propertyfile="../../etc/hibernate.properties">
- <fileset dir=".">
- <include name="SomeClasses.hbm.xml"/>
- </fileset>
- </configuration>
+ <hibernatetool destdir="${build.dir}/bottomupoverride">
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packagename="test" revengfile="hibernate.reveng.xml" />
- <hbm2java jdk5="true"/>
- </hibernatetool>
-</target>
+ <hbm2java />
+ </hibernatetool>
+ </target>
- <property name="hbm2java.ejb3" value="weird"/>
- <property name="hbm2java.anothervalue" value="weirdo"/>
-
- <target name="testproperties">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
+ <target name="testanthbm2java">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+ <hibernatetool destdir="${build.dir}/bottomup">
+ <configuration propertyfile="../../etc/hibernate.properties">
+ <fileset dir=".">
+ <include name="SomeClasses.hbm.xml" />
+ </fileset>
+ </configuration>
- <property name="org.hibernate.tool.hbm2x.weirdAl" value="weirdAl"/>
-
- <hibernatetool destdir="${build.dir}/bottomup">
- <configuration propertyfile="../../etc/hibernate.properties">
- <fileset dir=".">
- <include name="SomeClasses.hbm.xml"/>
- </fileset>
- </configuration>
+ <hbm2java jdk5="true" />
+ </hibernatetool>
+ </target>
- <hbm2java jdk5="true">
- <propertyset>
- <propertyref builtin="all"/>
- <propertyref name="hbm2java.ejb3"/>
- <propertyref prefix="hbm2java"/>
- </propertyset>
- <property key="mykey" file="c"/>
- <property key="mykey" value="c"/>
- </hbm2java>
- </hibernatetool>
- </target>
+ <property name="hbm2java.ejb3" value="weird" />
+ <property name="hbm2java.anothervalue" value="weirdo" />
- <target name="testgeneric">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
- <hibernatetool destdir="${build.dir}/generic" templatepath="generictemplates">
- <configuration propertyfile="../../etc/hibernate.properties">
- <fileset dir="../test" id="id">
- <include name="**/*TopDown.hbm.xml"/>
- </fileset>
- </configuration>
+ <target name="testproperties">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
- <hbmtemplate templateprefix="pojo/" template="pojo/Pojo.ftl" filepattern="X{package-name}/{class-name}.java">
- <property key="jdk5" value="false"/>
- <property key="ejb3" value="false"/>
- </hbmtemplate>
- <hbm2java/>
-
- <hbmtemplate template="pojo/generic-class.ftl" filepattern="{package-name}/{class-name}.quote"/>
- <hbmtemplate exporterclass="org.hibernate.tool.hbm2x.POJOExporter" filepattern="{package-name}/{class-name}.quote"/>
- </hibernatetool>
- </target>
+ <property name="org.hibernate.tool.hbm2x.weirdAl" value="weirdAl" />
- <target name="testexceptions">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
- <hibernatetool destdir="${build.dir}/generic" templatepath="generictemplates">
- <configuration propertyfile="../../etc/hibernate.properties">
- <fileset dir="../test" id="id">
- <include name="**/*TopDown.hbm.xml"/>
- </fileset>
- </configuration>
+ <hibernatetool destdir="${build.dir}/bottomup">
+ <configuration propertyfile="../../etc/hibernate.properties">
+ <fileset dir=".">
+ <include name="SomeClasses.hbm.xml" />
+ </fileset>
+ </configuration>
- <hbmtemplate template="generic-exception.ftl" filepattern="{package-name}/{class-name}.error"/>
- </hibernatetool>
- </target>
-
-<target name="testantannotationcfg">
- <path id="annlib">
- <path location="${hibernate-core.jar}"/>
- <path location="${build.dir}/../../lib/testlibs/hibernate-annotations.jar"/>
- <path location="${build.dir}/../../lib/testlibs/ejb3-persistence.jar"/>
- <path location="${build.dir}/../classes"/>
- <path location="${build.dir}/../../etc"/>
- <path location="${hibernate-core.home}\jdbc\hsqldb.jar"/>
- <fileset dir="${hibernate-core.lib.dir}">
- <include name="*.jar"/>
- </fileset>
- </path>
- <taskdef name="hibernatetoolx" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="annlib"/>
- <hibernatetoolx destdir="${build.dir}/bottomup">
- <annotationconfiguration configurationfile="test-hibernate.cfg.xml"/>
- <hbm2ddl console="true" export="false"/>
- </hibernatetoolx>
-</target>
+ <hbm2java jdk5="true">
+ <propertyset>
+ <propertyref builtin="all" />
+ <propertyref name="hbm2java.ejb3" />
+ <propertyref prefix="hbm2java" />
+ </propertyset>
+ <property key="mykey" file="c" />
+ <property key="mykey" value="c" />
+ </hbm2java>
+ </hibernatetool>
+ </target>
-<target name="testantejb3hbm2java">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
+ <target name="testgeneric">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+ <hibernatetool destdir="${build.dir}/generic" templatepath="generictemplates">
+ <configuration propertyfile="../../etc/hibernate.properties">
+ <fileset dir="../test" id="id">
+ <include name="**/*TopDown.hbm.xml" />
+ </fileset>
+ </configuration>
-<hibernatetool destdir="${build.dir}/bottomup">
- <configuration propertyfile="../../etc/hibernate.properties">
- <fileset dir="../test/org/hibernate/tool/hbm2x">
- <include name="**/*.hbm.xml"/>
- </fileset>
- </configuration>
+ <hbmtemplate templateprefix="pojo/" template="pojo/Pojo.ftl" filepattern="X{package-name}/{class-name}.java">
+ <property key="jdk5" value="false" />
+ <property key="ejb3" value="false" />
+ </hbmtemplate>
+ <hbm2java />
- <hbm2java ejb3="true"/>
-</hibernatetool>
+ <hbmtemplate template="pojo/generic-class.ftl" filepattern="{package-name}/{class-name}.quote" />
+ <hbmtemplate exporterclass="org.hibernate.tool.hbm2x.POJOExporter" filepattern="{package-name}/{class-name}.quote" />
+ </hibernatetool>
+ </target>
-</target>
+ <target name="testexceptions">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+ <hibernatetool destdir="${build.dir}/generic" templatepath="generictemplates">
+ <configuration propertyfile="../../etc/hibernate.properties">
+ <fileset dir="../test" id="id">
+ <include name="**/*TopDown.hbm.xml" />
+ </fileset>
+ </configuration>
-<target name="prepareCfg2hbm" description="prepare for cfg2hbm tasks">
- <sql onerror="continue"
- driver="${hibernate.connection.driver_class}"
- url="${hibernate.connection.url}"
- userid="${hibernate.connection.username}"
- password="${hibernate.connection.password}"
- classpath="${hibernate-core.lib.dir}/hsqldb-1.7.3.3.jar">
- create table VeriSimplyTable ( id bigint not null, name varchar(255), primary key (id) )
+ <hbmtemplate template="generic-exception.ftl" filepattern="{package-name}/{class-name}.error" />
+ </hibernatetool>
+ </target>
+
+ <target name="testantannotationcfg">
+ <path id="annlib">
+ <path location="${hibernate-core.jar}" />
+ <path location="${build.dir}/../../lib/testlibs/hibernate-annotations.jar" />
+ <path location="${build.dir}/../../lib/testlibs/ejb3-persistence.jar" />
+ <path location="${build.dir}/../classes" />
+ <path location="${build.dir}/../../etc" />
+ <path location="${hibernate-core.home}\jdbc\hsqldb.jar" />
+ <fileset dir="${hibernate-core.lib.dir}">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+ <taskdef name="hibernatetoolx" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="annlib" />
+ <hibernatetoolx destdir="${build.dir}/bottomup">
+ <annotationconfiguration configurationfile="test-hibernate.cfg.xml" />
+ <hbm2ddl console="true" export="false" />
+ </hibernatetoolx>
+ </target>
+
+ <target name="testantejb3cfg">
+ <path id="annlib">
+ <path location="${build.dir}/../../lib/freemarker.jar" />
+
+ <path location="${build.dir}/../../lib/testlibs/hibernate3.jar" />
+ <path location="${build.dir}/../../lib/testlibs/hibernate-annotations.jar" />
+ <path location="${build.dir}/../../lib/testlibs/ejb3-persistence.jar" />
+ <path location="${build.dir}/../../lib/testlibs/hibernate-entitymanager.jar" />
+ <path location="${build.dir}/../../lib/testlibs/jboss-archive-browsing.jar" />
+ <path location="${build.dir}/../../lib/testlibs/javaassist.jar" />
+ <path location="${build.dir}/../classes" />
+ <path location="${hibernate-core.home}\jdbc\hsqldb.jar" />
+ <!-- <fileset dir="${hibernate-core.lib.dir}">
+
+ </fileset>-->
+ </path>
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="annlib" />
+
+ <delete dir="${build.dir}/ejb3" />
+ <mkdir dir="${build.dir}/ejb3" />
+
+ <antcall target="prepareCfg2hbm" />
+ <hibernatetool>
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" />
+ <hbm2java ejb3="true" jdk5="true" destdir="${build.dir}/ejb3/src" />
+ </hibernatetool>
+
+ <mkdir dir="${build.dir}/ejb3/classes" />
+ <javac classpathref="annlib" srcdir="${build.dir}/ejb3/src" destdir="${build.dir}/ejb3/classes" />
+
+ <copy file="ejb3test-persistence.xml" tofile="${build.dir}/ejb3/classes/META-INF/persistence.xml" />
+ <copy file="ejb3test-hibernate.cfg.xml" tofile="${build.dir}/ejb3/classes/ejb3test-hibernate.cfg.xml" />
+
+ <hibernatetool destdir="${build.dir}">
+ <ejb3configuration />
+ <classpath>
+ <path location="${build.dir}/ejb3/classes" />
+ </classpath>
+ <hbm2ddl export="false" outputfilename="ejb3.sql" />
+ </hibernatetool>
+
+ <antcall target="afterCfg2hbm" />
+ </target>
+
+ <target name="testantejb3hbm2java">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+
+ <hibernatetool destdir="${build.dir}/bottomup">
+ <configuration propertyfile="../../etc/hibernate.properties">
+ <fileset dir="../test/org/hibernate/tool/hbm2x">
+ <include name="**/*.hbm.xml" />
+ </fileset>
+ </configuration>
+
+ <hbm2java ejb3="true" />
+ </hibernatetool>
+
+ </target>
+
+ <target name="prepareCfg2hbm" description="prepare for cfg2hbm tasks">
+ <sql onerror="continue" driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${hibernate-core.home}\jdbc\hsqldb.jar">
+ create table VeriSimplyTable ( id bigint not null, name varchar(255), primary key (id) );
+ SHUTDOWN;
</sql>
- <delete dir="${build.dir}/cfg2hbm" failonerror="false"/>
- <mkdir dir="${build.dir}/cfg2hbm"/>
-</target>
+ <delete dir="${build.dir}/cfg2hbm" failonerror="false" />
+ <mkdir dir="${build.dir}/cfg2hbm" />
+ </target>
-<target name="afterCfg2hbm" description="prepare for cfg2hbm tasks">
- <sql onerror="continue"
- driver="${hibernate.connection.driver_class}"
- url="${hibernate.connection.url}"
- userid="${hibernate.connection.username}"
- password="${hibernate.connection.password}"
- classpath="${hibernate-core.lib.dir}/hsqldb-1.7.3.3.jar">
- drop table VeriSimplyTable
+ <target name="afterCfg2hbm" description="prepare for cfg2hbm tasks">
+ <sql onerror="continue" driver="${hibernate.connection.driver_class}" url="${hibernate.connection.url}" userid="${hibernate.connection.username}" password="${hibernate.connection.password}" classpath="${hibernate-core.home}\jdbc\hsqldb.jar">
+ drop table VeriSimplyTable;
+ SHUTDOWN;
</sql>
- </target>
-
-<target name="testantcfg2hbm1" depends="prepareCfg2hbm" description="simple CFG2HBM">
-<taskdef name="hibernatetool"
- classname="org.hibernate.tool.ant.HibernateToolTask"
- classpathref="tasks.classpath"/>
+ </target>
- <hibernatetool>
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties"/>
- <hbm2hbmxml destdir="${build.dir}/cfg2hbm"/>
- </hibernatetool>
-
- <antcall target="afterCfg2hbm"/>
-</target>
+ <target name="testantcfg2hbm1" depends="prepareCfg2hbm" description="simple CFG2HBM">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
-<target name="testantcfg2hbm2" depends="prepareCfg2hbm" description="valid custom ReverseEngineeringStrategy">
-<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
+ <hibernatetool>
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" />
+ <hbm2hbmxml destdir="${build.dir}/cfg2hbm" />
+ </hibernatetool>
- <hibernatetool>
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties"/>
-
- <hbm2hbmxml destdir="${build.dir}/cfg2hbm"/>
- </hibernatetool>
-
- <antcall target="afterCfg2hbm"/>
-</target>
+ <antcall target="afterCfg2hbm" />
+ </target>
-<target name="testantcfg2hbm3" depends="prepareCfg2hbm" description="invalid ReverseEngineeringStrategy classname">
-<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
+ <target name="testantcfg2hbm2" depends="prepareCfg2hbm" description="valid custom ReverseEngineeringStrategy">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
- <hibernatetool>
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties" reversestrategy="invalid.classname" />
- <hbm2hbmxml destdir="${build.dir}/cfg2hbm"/>
- </hibernatetool>
-
- <antcall target="afterCfg2hbm"/>
-
-</target>
+ <hibernatetool>
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" />
-<target name="testantcfg2hbm4" depends="prepareCfg2hbm" description="CFG2HBM with packageName">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
+ <hbm2hbmxml destdir="${build.dir}/cfg2hbm" />
+ </hibernatetool>
- <hibernatetool>
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packageName="org.h3.test"/>
- <hbm2hbmxml destdir="${build.dir}/cfg2hbm"/>
- </hibernatetool>
-
- <antcall target="afterCfg2hbm"/>
-</target>
+ <antcall target="afterCfg2hbm" />
+ </target>
-<target name="testantcfg2hbm5" depends="prepareCfg2hbm" description="CFG2HBM with packageName and ReverseEngineeringStrategy">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
+ <target name="testantcfg2hbm3" depends="prepareCfg2hbm" description="invalid ReverseEngineeringStrategy classname">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
- <hibernatetool>
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packageName="org.h3.test" reversestrategy="org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy"/>
- <hbm2hbmxml destdir="${build.dir}/cfg2hbm"/>
- </hibernatetool>
-
- <antcall target="afterCfg2hbm"/>
-</target>
-
- <target name="noconinfoexport" description="hbm2ddl without connection info">
- <mkdir dir="${build.dir}/noconinfo"/>
+ <hibernatetool>
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" reversestrategy="invalid.classname" />
+ <hbm2hbmxml destdir="${build.dir}/cfg2hbm" />
+ </hibernatetool>
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
+ <antcall target="afterCfg2hbm" />
- <hibernatetool destdir="${build.dir}/noconinfo">
- <configuration configurationfile="noconnectioninfo-hibernate.cfg.xml">
- <fileset dir="../test" id="id">
- <include name="**/*TopDown.hbm.xml"/>
- </fileset>
- </configuration>
- <hbm2ddl haltonerror="true" export="false" outputfilename="noconinfo.sql"/>
- </hibernatetool>
- </target>
+ </target>
- <target name="testnoexporters" description="tool without anyexporters - should fail">
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath"/>
- <hibernatetool>
- <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packageName="org.h3.test" reversestrategy="org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy"/>
- </hibernatetool>
- </target>
+ <target name="testantcfg2hbm4" depends="prepareCfg2hbm" description="CFG2HBM with packageName">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+
+ <hibernatetool>
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packageName="org.h3.test" />
+ <hbm2hbmxml destdir="${build.dir}/cfg2hbm" />
+ </hibernatetool>
+
+ <antcall target="afterCfg2hbm" />
+ </target>
+
+ <target name="testantcfg2hbm5" depends="prepareCfg2hbm" description="CFG2HBM with packageName and ReverseEngineeringStrategy">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+
+ <hibernatetool>
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packageName="org.h3.test" reversestrategy="org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy" />
+ <hbm2hbmxml destdir="${build.dir}/cfg2hbm" />
+ </hibernatetool>
+
+ <antcall target="afterCfg2hbm" />
+ </target>
+
+ <target name="noconinfoexport" description="hbm2ddl without connection info">
+ <mkdir dir="${build.dir}/noconinfo" />
+
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+
+ <hibernatetool destdir="${build.dir}/noconinfo">
+ <configuration configurationfile="noconnectioninfo-hibernate.cfg.xml">
+ <fileset dir="../test" id="id">
+ <include name="**/*TopDown.hbm.xml" />
+ </fileset>
+ </configuration>
+ <hbm2ddl haltonerror="true" export="false" outputfilename="noconinfo.sql" />
+ </hibernatetool>
+ </target>
+
+ <target name="testnoexporters" description="tool without anyexporters - should fail">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="tasks.classpath" />
+ <hibernatetool>
+ <jdbcconfiguration propertyfile="../../etc/hibernate.properties" packageName="org.h3.test" reversestrategy="org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy" />
+ </hibernatetool>
+ </target>
</project>
|
|
From: <hib...@li...> - 2006-03-29 14:35:42
|
Author: ste...@jb...
Date: 2006-03-29 09:35:31 -0500 (Wed, 29 Mar 2006)
New Revision: 9714
Modified:
trunk/Hibernate3/test/org/hibernate/test/connections/AggressiveReleaseTest.java
Log:
added more Query.scroll/iterate checks
Modified: trunk/Hibernate3/test/org/hibernate/test/connections/AggressiveReleaseTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/connections/AggressiveReleaseTest.java 2006-03-29 13:57:11 UTC (rev 9713)
+++ trunk/Hibernate3/test/org/hibernate/test/connections/AggressiveReleaseTest.java 2006-03-29 14:35:31 UTC (rev 9714)
@@ -4,6 +4,7 @@
import org.hibernate.Session;
import org.hibernate.ConnectionReleaseMode;
import org.hibernate.ScrollableResults;
+import org.hibernate.Hibernate;
import org.hibernate.transaction.CMTTransactionFactory;
import org.hibernate.impl.SessionImpl;
import org.hibernate.util.SerializationHelper;
@@ -118,6 +119,68 @@
done();
}
+ public void testQueryIteration() throws Throwable {
+ prepare();
+ Session s = getSessionUnderTest();
+ Silly silly = new Silly( "silly" );
+ s.save( silly );
+ s.flush();
+
+ Iterator itr = s.createQuery( "from Silly" ).iterate();
+ assertTrue( itr.hasNext() );
+ Silly silly2 = ( Silly ) itr.next();
+ assertEquals( silly, silly2 );
+ Hibernate.close( itr );
+
+ itr = s.createQuery( "from Silly" ).iterate();
+ Iterator itr2 = s.createQuery( "from Silly where name = 'silly'" ).iterate();
+
+ assertTrue( itr.hasNext() );
+ assertEquals( silly, itr.next() );
+ assertTrue( itr2.hasNext() );
+ assertEquals( silly, itr2.next() );
+
+ Hibernate.close( itr );
+ Hibernate.close( itr2 );
+
+ s.delete( silly );
+ s.flush();
+
+ release( s );
+ done();
+ }
+
+ public void testQueryScrolling() throws Throwable {
+ prepare();
+ Session s = getSessionUnderTest();
+ Silly silly = new Silly( "silly" );
+ s.save( silly );
+ s.flush();
+
+ ScrollableResults sr = s.createQuery( "from Silly" ).scroll();
+ assertTrue( sr.next() );
+ Silly silly2 = ( Silly ) sr.get( 0 );
+ assertEquals( silly, silly2 );
+ sr.close();
+
+ sr = s.createQuery( "from Silly" ).scroll();
+ ScrollableResults sr2 = s.createQuery( "from Silly where name = 'silly'" ).scroll();
+
+ assertTrue( sr.next() );
+ assertEquals( silly, sr.get( 0 ) );
+ assertTrue( sr2.next() );
+ assertEquals( silly, sr2.get( 0 ) );
+
+ sr.close();
+ sr2.close();
+
+ s.delete( silly );
+ s.flush();
+
+ release( s );
+ done();
+ }
+
public void testSuppliedConnection() throws Throwable {
prepare();
|
|
From: <hib...@li...> - 2006-03-29 13:57:30
|
Author: ste...@jb...
Date: 2006-03-29 08:57:11 -0500 (Wed, 29 Mar 2006)
New Revision: 9713
Modified:
branches/Branch_3_1/Hibernate3/src/org/hibernate/util/PropertiesHelper.java
Log:
HHH-1560 : account for non-string system properties
Modified: branches/Branch_3_1/Hibernate3/src/org/hibernate/util/PropertiesHelper.java
===================================================================
--- branches/Branch_3_1/Hibernate3/src/org/hibernate/util/PropertiesHelper.java 2006-03-29 13:56:59 UTC (rev 9712)
+++ branches/Branch_3_1/Hibernate3/src/org/hibernate/util/PropertiesHelper.java 2006-03-29 13:57:11 UTC (rev 9713)
@@ -11,7 +11,6 @@
public final class PropertiesHelper {
private static final String PLACEHOLDER_START = "${";
- private static final String PLACEHOLDER_END = "}";
public static boolean getBoolean(String property, Properties properties) {
String setting = properties.getProperty(property);
@@ -85,9 +84,9 @@
Iterator itr = properties.entrySet().iterator();
while ( itr.hasNext() ) {
final Map.Entry entry = ( Map.Entry ) itr.next();
- final String value = ( String ) entry.getValue();
- if ( value != null ) {
- final String resolved = resolvePlaceHolder( value );
+ final Object value = entry.getValue();
+ if ( value != null && String.class.isInstance( value ) ) {
+ final String resolved = resolvePlaceHolder( ( String ) value );
if ( !value.equals( resolved ) ) {
if ( resolved == null ) {
itr.remove();
|
|
From: <hib...@li...> - 2006-03-29 13:57:17
|
Author: ste...@jb...
Date: 2006-03-29 08:56:59 -0500 (Wed, 29 Mar 2006)
New Revision: 9712
Modified:
trunk/Hibernate3/src/org/hibernate/util/PropertiesHelper.java
Log:
HHH-1560 : account for non-string system properties
Modified: trunk/Hibernate3/src/org/hibernate/util/PropertiesHelper.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/util/PropertiesHelper.java 2006-03-29 12:58:12 UTC (rev 9711)
+++ trunk/Hibernate3/src/org/hibernate/util/PropertiesHelper.java 2006-03-29 13:56:59 UTC (rev 9712)
@@ -11,7 +11,6 @@
public final class PropertiesHelper {
private static final String PLACEHOLDER_START = "${";
- private static final String PLACEHOLDER_END = "}";
public static boolean getBoolean(String property, Properties properties) {
String setting = properties.getProperty(property);
@@ -85,9 +84,9 @@
Iterator itr = properties.entrySet().iterator();
while ( itr.hasNext() ) {
final Map.Entry entry = ( Map.Entry ) itr.next();
- final String value = ( String ) entry.getValue();
- if ( value != null ) {
- final String resolved = resolvePlaceHolder( value );
+ final Object value = entry.getValue();
+ if ( value != null && String.class.isInstance( value ) ) {
+ final String resolved = resolvePlaceHolder( ( String ) value );
if ( !value.equals( resolved ) ) {
if ( resolved == null ) {
itr.remove();
|
|
From: <hib...@li...> - 2006-03-29 12:58:18
|
Author: max...@jb...
Date: 2006-03-29 07:58:12 -0500 (Wed, 29 Mar 2006)
New Revision: 9711
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
Log:
EJB-155 bad cast.
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2006-03-29 08:56:23 UTC (rev 9710)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/packaging/PersistenceXmlLoader.java 2006-03-29 12:58:12 UTC (rev 9711)
@@ -98,7 +98,7 @@
metadata.setNonJtaDatasource( dataSource );
}
Properties properties = metadata.getProps();
- for ( Map.Entry entry : (Set<Map.Entry>) overrides.keySet() ) {
+ for ( Map.Entry entry : (Set<Map.Entry>) overrides.entrySet() ) {
if ( entry.getKey() instanceof String && entry.getValue() instanceof String ) {
properties.setProperty( (String) entry.getKey(), (String) entry.getValue() );
}
|