Hibernate SVN: r17743 - in validator/trunk/hibernate-validator/src: test/java/org/hibernate/validator/xml and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-10-14 07:47:08 -0400 (Wed, 14 Oct 2009)
New Revision: 17743
Added:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java
validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java
Log:
HV-252 Made sure that the properties list gets updated even if ignore annotations is specified in xml
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java 2009-10-14 08:11:10 UTC (rev 17742)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/metadata/BeanMetaDataImpl.java 2009-10-14 11:47:08 UTC (rev 17743)
@@ -96,7 +96,10 @@
*/
private final ConstraintHelper constraintHelper;
- //updated on the fly, needs to be thread safe
+ /**
+ * A list of all property names in the class (constraint and un-constraint).
+ */
+ // Used to avoid ReflectionHelper#containsMembe which is slow
private final Set<String> propertyNames = new HashSet<String>( 30 );
public BeanMetaDataImpl(Class<T> beanClass, ConstraintHelper constraintHelper) {
@@ -166,6 +169,7 @@
}
public void addCascadedMember(Member member) {
+ setAccessibility( member );
cascadedMembers.add( member );
addPropertyDescriptorForMember( member, true );
}
@@ -175,7 +179,7 @@
}
public boolean isPropertyPresent(String name) {
- return propertyNames.contains( name ); //To change body of implemented methods use File | Settings | File Templates.
+ return propertyNames.contains( name );
}
public List<Class<?>> getDefaultGroupSequence() {
@@ -265,6 +269,8 @@
fields = action.run();
}
for ( Field field : fields ) {
+ addToPropertyNameList( field );
+
// HV-172
if ( Modifier.isStatic( field.getModifiers() ) ) {
continue;
@@ -274,11 +280,6 @@
continue;
}
- String name = ReflectionHelper.getPropertyName( field );
- if ( name != null ) {
- propertyNames.add( name );
- }
-
List<ConstraintDescriptorImpl<?>> fieldMetaData = findConstraints( field, ElementType.FIELD );
for ( ConstraintDescriptorImpl<?> constraintDescription : fieldMetaData ) {
setAccessibility( field );
@@ -287,12 +288,18 @@
}
if ( field.isAnnotationPresent( Valid.class ) ) {
- setAccessibility( field );
addCascadedMember( field );
}
}
}
+ private void addToPropertyNameList(Member member) {
+ String name = ReflectionHelper.getPropertyName( member );
+ if ( name != null ) {
+ propertyNames.add( name );
+ }
+ }
+
private void setAccessibility(Member member) {
SetAccessibility action = SetAccessibility.action( member );
if ( System.getSecurityManager() != null ) {
@@ -314,6 +321,8 @@
}
for ( Method method : declaredMethods ) {
+ addToPropertyNameList( method );
+
// HV-172
if ( Modifier.isStatic( method.getModifiers() ) ) {
continue;
@@ -323,11 +332,6 @@
continue;
}
- String name = ReflectionHelper.getPropertyName( method );
- if ( name != null ) {
- propertyNames.add( name );
- }
-
List<ConstraintDescriptorImpl<?>> methodMetaData = findConstraints( method, ElementType.METHOD );
for ( ConstraintDescriptorImpl<?> constraintDescription : methodMetaData ) {
setAccessibility( method );
@@ -335,7 +339,6 @@
addMetaConstraint( clazz, metaConstraint );
}
if ( method.isAnnotationPresent( Valid.class ) ) {
- setAccessibility( method );
addCascadedMember( method );
}
}
Added: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java (rev 0)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java 2009-10-14 11:47:08 UTC (rev 17743)
@@ -0,0 +1,37 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat, Inc. and/or its affiliates, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.validator.xml;
+
+import java.util.List;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class Properties {
+ private List<String> listOfString;
+
+ public List<String> getListOfString() {
+ return listOfString;
+ }
+
+ public void setListOfString(List<String> listOfString) {
+ this.listOfString = listOfString;
+ }
+}
+
+
Property changes on: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/Properties.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java 2009-10-14 08:11:10 UTC (rev 17742)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/xml/XmlMappingTest.java 2009-10-14 11:47:08 UTC (rev 17743)
@@ -17,6 +17,8 @@
*/
package org.hibernate.validator.xml;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import javax.validation.Configuration;
import javax.validation.ConstraintViolation;
@@ -49,4 +51,28 @@
assertEquals( violations.size(), 1 );
}
+
+ @Test
+ /**
+ * HV-252
+ */
+ public void testListOfString() {
+
+ final Configuration<?> configuration = Validation.byDefaultProvider().configure();
+ configuration.addMapping( XmlMappingTest.class.getResourceAsStream( "properties-mapping.xml" ) );
+
+ final ValidatorFactory validatorFactory = configuration.buildValidatorFactory();
+ final Validator validator = validatorFactory.getValidator();
+
+ List<String> listOfString = new ArrayList<String>();
+ listOfString.add( "one" );
+ listOfString.add( "two" );
+ listOfString.add( "three" );
+
+ final Set<ConstraintViolation<Properties>> violations = validator.validateValue(
+ Properties.class, "listOfString", listOfString
+ );
+
+ assertEquals( violations.size(), 0 );
+ }
}
Copied: validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml (from rev 17637, validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/mapping.xml)
===================================================================
--- validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml (rev 0)
+++ validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml 2009-10-14 11:47:08 UTC (rev 17743)
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<constraint-mappings xmlns="http://jboss.org/xml/ns/javax/validation/mapping"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd">
+ <default-package>org.hibernate.validator.xml</default-package>
+ <bean class="Properties" ignore-annotations="true">
+ <getter name="listOfString" ignore-annotations="true">
+ <constraint annotation="javax.validation.constraints.NotNull" />
+ </getter>
+ </bean>
+</constraint-mappings>
\ No newline at end of file
Property changes on: validator/trunk/hibernate-validator/src/test/resources/org/hibernate/validator/xml/properties-mapping.xml
___________________________________________________________________
Name: svn:keywords
+ Id
14 years, 8 months
Hibernate SVN: r17742 - in entitymanager/branches/v3_3_2_GA_CP/src/test: org/hibernate/ejb/test/connection and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-10-14 04:11:10 -0400 (Wed, 14 Oct 2009)
New Revision: 17742
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/hibernate.properties
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/connection/FakeDataSource.java
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/Employee.java
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java
Log:
JBPAPP-1679 Modify Annotations, Entity Manager, and Search to work with the same property settings as Core
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/hibernate.properties
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/hibernate.properties 2009-10-14 06:19:33 UTC (rev 17741)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/hibernate.properties 2009-10-14 08:11:10 UTC (rev 17742)
@@ -1,30 +1,10 @@
-###############
-### EJB 3.0 ###
-###############
-
-## select Hibernate persistence provider
-
-javax.persistence.provider org.hibernate.ejb.HibernatePersistence
-javax.persistence.transactionType=RESOURCE_LOCAL
-
-## entity bean class name (comma separated)
-
-#hibernate.ejb.classes org.hibernate.ejb.test.Item, org.hibernate.ejb.test.Distributor
-
-## entity caching (strategy, optional region name)
-#hibernate.ejb.classcache.org.hibernate.ejb.test.Item read-write, RegionName
-#hibernate.ejb.classcache.org.hibernate.ejb.test.Item read-write
-
-## collection caching (role, optional region name)
-#hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors read-write, RegionName
-
######################
### Query Language ###
######################
## define query language constants / function names
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
+hibernate.query.substitutions yes 'Y', no 'N'
## select the classic query parser
@@ -50,52 +30,65 @@
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.username sa
hibernate.connection.password
-hibernate.connection.url jdbc:hsqldb:hsql://localhost
-hibernate.connection.url jdbc:hsqldb:test
-hibernate.connection.url jdbc:hsqldb:.
+hibernate.connection.url jdbc:hsqldb:./build/db/hsqldb/hibernate
+#hibernate.connection.url jdbc:hsqldb:hsql://localhost
+#hibernate.connection.url jdbc:hsqldb:test
+## H2 (www.h2database.com)
+#hibernate.dialect org.hibernate.dialect.H2Dialect
+#hibernate.connection.driver_class org.h2.Driver
+#hibernate.connection.username sa
+#hibernate.connection.password
+#hibernate.connection.url jdbc:h2:mem:./build/db/h2/hibernate
+#hibernate.connection.url jdbc:h2:testdb/h2test
+#hibernate.connection.url jdbc:h2:mem:imdb1
+#hibernate.connection.url jdbc:h2:tcp://dbserv:8084/sample;
+#hibernate.connection.url jdbc:h2:ssl://secureserv:8085/sample;
+#hibernate.connection.url jdbc:h2:ssl://secureserv/testdb;cipher=AES
## MySQL
#hibernate.dialect org.hibernate.dialect.MySQLDialect
#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
-#hibernate.connection.driver_class org.gjt.mm.mysql.Driver
#hibernate.connection.driver_class com.mysql.jdbc.Driver
#hibernate.connection.url jdbc:mysql:///test
-#hibernate.connection.username emmanuel
+#hibernate.connection.username gavin
#hibernate.connection.password
## Oracle
-#hibernate.dialect org.hibernate.dialect.OracleDialect
-#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
+#hibernate.dialect org.hibernate.dialect.Oracle8iDialect
+#hibernate.dialect org.hibernate.dialect.Oracle9iDialect
+#hibernate.dialect org.hibernate.dialect.Oracle10gDialect
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
#hibernate.connection.username ora
#hibernate.connection.password ora
-#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1522:XE
## PostgreSQL
#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
#hibernate.connection.driver_class org.postgresql.Driver
-#hibernate.connection.url jdbc:postgresql:annotations
-#hibernate.connection.username postgres
-#hibernate.connection.password hibernate
-#hibernate.query.substitutions yes 'Y', no 'N'
+#hibernate.connection.url jdbc:postgresql:template1
+#hibernate.connection.username pg
+#hibernate.connection.password
## DB2
#hibernate.dialect org.hibernate.dialect.DB2Dialect
+#hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2:test
+#hibernate.connection.url jdbc:db2://localhost:50000/somename
+#hibernate.connection.url jdbc:db2:somename
#hibernate.connection.username db2
#hibernate.connection.password db2
-## TimesTen (not supported yet)
+## TimesTen
#hibernate.dialect org.hibernate.dialect.TimesTenDialect
#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
@@ -118,13 +111,13 @@
#hibernate.connection.url jdbc:as400://systemname
-## Derby (Not supported!)
+## Derby (not supported!)
#hibernate.dialect org.hibernate.dialect.DerbyDialect
#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
#hibernate.connection.username
#hibernate.connection.password
-#hibernate.connection.url jdbc:derby:/test;create=true
+#hibernate.connection.url jdbc:derby:build/db/derby/hibernate;create=true
## Sybase
@@ -141,7 +134,7 @@
#hibernate.dialect org.hibernate.dialect.MckoiDialect
#hibernate.connection.driver_class com.mckoi.JDBCDriver
#hibernate.connection.url jdbc:mckoi:///
-#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
+#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.0.3/db.conf
#hibernate.connection.username admin
#hibernate.connection.password nimda
@@ -178,6 +171,10 @@
#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
+## The New Microsoft Driver
+#hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
+#hibernate.connection.url jdbc:sqlserver://localhost
+
## jTDS (since version 0.9)
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
@@ -210,7 +207,42 @@
#hibernate.connection.password PBPUBLIC
+## Ingres
+## older versions (before Ingress 2006)
+
+#hibernate.dialect org.hibernate.dialect.IngresDialect
+#hibernate.connection.driver_class ca.edbc.jdbc.EdbcDriver
+#hibernate.connection.url jdbc:edbc://localhost:II7/database
+#hibernate.connection.username user
+#hibernate.connection.password password
+
+## Ingres 2006 or later
+
+#hibernate.dialect org.hibernate.dialect.IngresDialect
+#hibernate.connection.driver_class com.ingres.jdbc.IngresDriver
+#hibernate.connection.url jdbc:ingres://localhost:II7/database;CURSOR=READONLY;auto=multi
+#hibernate.connection.username user
+#hibernate.connection.password password
+
+## Mimer SQL
+
+#hibernate.dialect org.hibernate.dialect.MimerSQLDialect
+#hibernate.connection.driver_class com.mimer.jdbc.Driver
+#hibernate.connection.url jdbc:mimer:multi1
+#hibernate.connection.username hibernate
+#hibernate.connection.password hibernate
+
+
+## InterSystems Cache
+
+#hibernate.dialect org.hibernate.dialect.Cache71Dialect
+#hibernate.connection.driver_class com.intersys.jdbc.CacheDriver
+#hibernate.connection.username _SYSTEM
+#hibernate.connection.password SYS
+#hibernate.connection.url jdbc:Cache://127.0.0.1:1972/HIBERNATE
+
+
#################################
### Hibernate Connection Pool ###
#################################
@@ -258,7 +290,6 @@
#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
@@ -313,6 +344,11 @@
#hibernate.show_sql true
+## format SQL in log and console
+
+hibernate.format_sql true
+
+
## add comments to the generated SQL
#hibernate.use_sql_comments true
@@ -325,9 +361,10 @@
## auto schema export
-hibernate.hbm2ddl.auto create-drop
+#hibernate.hbm2ddl.auto create-drop
#hibernate.hbm2ddl.auto create
#hibernate.hbm2ddl.auto update
+#hibernate.hbm2ddl.auto validate
## specify a default schema and catalog for unqualified tablenames
@@ -338,7 +375,7 @@
## enable ordering of SQL UPDATEs by primary key
-hibernate.order_updates true
+#hibernate.order_updates true
## set the maximum depth of the outer join fetch tree
@@ -348,7 +385,7 @@
## set the default batch size for batch fetching
-hibernate.default_batch_fetch_size 8
+#hibernate.default_batch_fetch_size 8
## rollback generated identifier values of deleted entities to default values
@@ -356,9 +393,9 @@
#hibernate.use_identifer_rollback true
-## enable CGLIB reflection optimizer (enabled by default)
+## enable bytecode reflection optimizer (disabled by default)
-#hibernate.cglib.use_reflection_optimizer false
+#hibernate.bytecode.use_reflection_optimizer true
@@ -384,6 +421,7 @@
## set the maximum JDBC 2 batch size (a nonzero value enables batching)
#hibernate.jdbc.batch_size 5
+#hibernate.jdbc.batch_size 0
## enable batch updates even for versioned data
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/connection/FakeDataSource.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/connection/FakeDataSource.java 2009-10-14 06:19:33 UTC (rev 17741)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/connection/FakeDataSource.java 2009-10-14 08:11:10 UTC (rev 17742)
@@ -33,4 +33,16 @@
public int getLoginTimeout() throws SQLException {
throw new FakeDataSourceException( "getLoginTimeout" );
}
+
+ @Override
+ public boolean isWrapperFor(Class<?> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public <T> T unwrap(Class<T> iface) throws SQLException {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/Employee.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/Employee.java 2009-10-14 06:19:33 UTC (rev 17741)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/Employee.java 2009-10-14 08:11:10 UTC (rev 17742)
@@ -7,7 +7,7 @@
/**
* @author Emmanuel Bernard
*/
-@Entity
+@Entity(name = "EMPLOYEE_XML")
public class Employee {
@Id
Long id;
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java 2009-10-14 06:19:33 UTC (rev 17741)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/xml/sequences/Employee.java 2009-10-14 08:11:10 UTC (rev 17742)
@@ -7,7 +7,7 @@
/**
* @author Emmanuel Bernard
*/
-@Entity
+@Entity(name = "EMPLOYEE_XML")
public class Employee {
@Id
Long id;
14 years, 8 months
You've received a postcard
by 123greetings.com
Good day.
Your family member has sent you an ecard from 123greetings.com.
Send free ecards from 123greetings.com with your choice of colors, words and music.
Your ecard will be available with us for the next 30 days.
If you wish to keep the ecard longer, you may save it on your computer or take a print.
To view your ecard, open zip attached file.
14 years, 8 months
Hibernate SVN: r17741 - search/branches/Branch_3_0_1_GA_CP/src/test.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-10-14 02:19:33 -0400 (Wed, 14 Oct 2009)
New Revision: 17741
Modified:
search/branches/Branch_3_0_1_GA_CP/src/test/hibernate.properties
Log:
JBPAPP-1679 Modify Annotations, Entity Manager, and Search to work with the same property settings as Core
Modified: search/branches/Branch_3_0_1_GA_CP/src/test/hibernate.properties
===================================================================
--- search/branches/Branch_3_0_1_GA_CP/src/test/hibernate.properties 2009-10-14 06:14:59 UTC (rev 17740)
+++ search/branches/Branch_3_0_1_GA_CP/src/test/hibernate.properties 2009-10-14 06:19:33 UTC (rev 17741)
@@ -4,17 +4,15 @@
## define query language constants / function names
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
+hibernate.query.substitutions yes 'Y', no 'N'
## select the classic query parser
#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
-hibernate.format_sql true
-
#################
### Platforms ###
#################
@@ -32,10 +30,21 @@
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.username sa
hibernate.connection.password
+hibernate.connection.url jdbc:hsqldb:./build/db/hsqldb/hibernate
#hibernate.connection.url jdbc:hsqldb:hsql://localhost
#hibernate.connection.url jdbc:hsqldb:test
-hibernate.connection.url jdbc:hsqldb:mem:common
+## H2 (www.h2database.com)
+#hibernate.dialect org.hibernate.dialect.H2Dialect
+#hibernate.connection.driver_class org.h2.Driver
+#hibernate.connection.username sa
+#hibernate.connection.password
+#hibernate.connection.url jdbc:h2:mem:./build/db/h2/hibernate
+#hibernate.connection.url jdbc:h2:testdb/h2test
+#hibernate.connection.url jdbc:h2:mem:imdb1
+#hibernate.connection.url jdbc:h2:tcp://dbserv:8084/sample;
+#hibernate.connection.url jdbc:h2:ssl://secureserv:8085/sample;
+#hibernate.connection.url jdbc:h2:ssl://secureserv/testdb;cipher=AES
## MySQL
@@ -44,39 +53,42 @@
#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
#hibernate.connection.driver_class com.mysql.jdbc.Driver
#hibernate.connection.url jdbc:mysql:///test
-#hibernate.connection.username emmanuel
+#hibernate.connection.username gavin
#hibernate.connection.password
## Oracle
-#hibernate.dialect org.hibernate.dialect.OracleDialect
-#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
+#hibernate.dialect org.hibernate.dialect.Oracle8iDialect
+#hibernate.dialect org.hibernate.dialect.Oracle9iDialect
+#hibernate.dialect org.hibernate.dialect.Oracle10gDialect
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
#hibernate.connection.username ora
#hibernate.connection.password ora
-#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1522:XE
## PostgreSQL
#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
#hibernate.connection.driver_class org.postgresql.Driver
-#hibernate.connection.url jdbc:postgresql:annotations
-#hibernate.connection.username postgres
-#hibernate.connection.password hibernate
-#hibernate.query.substitutions yes 'Y', no 'N'
+#hibernate.connection.url jdbc:postgresql:template1
+#hibernate.connection.username pg
+#hibernate.connection.password
## DB2
#hibernate.dialect org.hibernate.dialect.DB2Dialect
+#hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2:test
+#hibernate.connection.url jdbc:db2://localhost:50000/somename
+#hibernate.connection.url jdbc:db2:somename
#hibernate.connection.username db2
#hibernate.connection.password db2
-## TimesTen (not supported yet)
+## TimesTen
#hibernate.dialect org.hibernate.dialect.TimesTenDialect
#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
@@ -99,13 +111,13 @@
#hibernate.connection.url jdbc:as400://systemname
-## Derby (Not supported!)
+## Derby (not supported!)
#hibernate.dialect org.hibernate.dialect.DerbyDialect
#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
#hibernate.connection.username
#hibernate.connection.password
-#hibernate.connection.url jdbc:derby:/test;create=true
+#hibernate.connection.url jdbc:derby:build/db/derby/hibernate;create=true
## Sybase
@@ -122,7 +134,7 @@
#hibernate.dialect org.hibernate.dialect.MckoiDialect
#hibernate.connection.driver_class com.mckoi.JDBCDriver
#hibernate.connection.url jdbc:mckoi:///
-#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
+#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.0.3/db.conf
#hibernate.connection.username admin
#hibernate.connection.password nimda
@@ -159,6 +171,10 @@
#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
+## The New Microsoft Driver
+#hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
+#hibernate.connection.url jdbc:sqlserver://localhost
+
## jTDS (since version 0.9)
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
@@ -191,7 +207,42 @@
#hibernate.connection.password PBPUBLIC
+## Ingres
+## older versions (before Ingress 2006)
+
+#hibernate.dialect org.hibernate.dialect.IngresDialect
+#hibernate.connection.driver_class ca.edbc.jdbc.EdbcDriver
+#hibernate.connection.url jdbc:edbc://localhost:II7/database
+#hibernate.connection.username user
+#hibernate.connection.password password
+
+## Ingres 2006 or later
+
+#hibernate.dialect org.hibernate.dialect.IngresDialect
+#hibernate.connection.driver_class com.ingres.jdbc.IngresDriver
+#hibernate.connection.url jdbc:ingres://localhost:II7/database;CURSOR=READONLY;auto=multi
+#hibernate.connection.username user
+#hibernate.connection.password password
+
+## Mimer SQL
+
+#hibernate.dialect org.hibernate.dialect.MimerSQLDialect
+#hibernate.connection.driver_class com.mimer.jdbc.Driver
+#hibernate.connection.url jdbc:mimer:multi1
+#hibernate.connection.username hibernate
+#hibernate.connection.password hibernate
+
+
+## InterSystems Cache
+
+#hibernate.dialect org.hibernate.dialect.Cache71Dialect
+#hibernate.connection.driver_class com.intersys.jdbc.CacheDriver
+#hibernate.connection.username _SYSTEM
+#hibernate.connection.password SYS
+#hibernate.connection.url jdbc:Cache://127.0.0.1:1972/HIBERNATE
+
+
#################################
### Hibernate Connection Pool ###
#################################
@@ -239,7 +290,6 @@
#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
@@ -294,6 +344,11 @@
#hibernate.show_sql true
+## format SQL in log and console
+
+hibernate.format_sql true
+
+
## add comments to the generated SQL
#hibernate.use_sql_comments true
@@ -309,6 +364,7 @@
#hibernate.hbm2ddl.auto create-drop
#hibernate.hbm2ddl.auto create
#hibernate.hbm2ddl.auto update
+#hibernate.hbm2ddl.auto validate
## specify a default schema and catalog for unqualified tablenames
@@ -319,7 +375,7 @@
## enable ordering of SQL UPDATEs by primary key
-hibernate.order_updates true
+#hibernate.order_updates true
## set the maximum depth of the outer join fetch tree
@@ -329,7 +385,7 @@
## set the default batch size for batch fetching
-hibernate.default_batch_fetch_size 100
+#hibernate.default_batch_fetch_size 8
## rollback generated identifier values of deleted entities to default values
@@ -337,9 +393,9 @@
#hibernate.use_identifer_rollback true
-## enable CGLIB reflection optimizer (enabled by default)
+## enable bytecode reflection optimizer (disabled by default)
-#hibernate.cglib.use_reflection_optimizer false
+#hibernate.bytecode.use_reflection_optimizer true
@@ -364,6 +420,7 @@
## set the maximum JDBC 2 batch size (a nonzero value enables batching)
+#hibernate.jdbc.batch_size 5
#hibernate.jdbc.batch_size 0
@@ -425,7 +482,7 @@
## enable the query cache
-hibernate.cache.use_query_cache true
+#hibernate.cache.use_query_cache true
## store the second-level cache entries in a more human-friendly format
14 years, 8 months
Hibernate SVN: r17740 - entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lob.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-10-14 02:14:59 -0400 (Wed, 14 Oct 2009)
New Revision: 17740
Modified:
entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lob/BlobTest.java
Log:
JBPAPP-1586 Sybase - EntityManager - unit tests using LOBs fail
Modified: entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lob/BlobTest.java
===================================================================
--- entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lob/BlobTest.java 2009-10-14 06:08:44 UTC (rev 17739)
+++ entitymanager/branches/v3_3_2_GA_CP/src/test/org/hibernate/ejb/test/lob/BlobTest.java 2009-10-14 06:14:59 UTC (rev 17740)
@@ -10,6 +10,7 @@
import javax.persistence.EntityManager;
import org.hibernate.Hibernate;
+import org.hibernate.dialect.Dialect;
import org.hibernate.ejb.test.TestCase;
/**
@@ -40,6 +41,11 @@
em.getTransaction().commit();
em.close();
}
+
+ @Override
+ public boolean appliesTo(Dialect dialect) {
+ return dialect.supportsExpectedLobUsagePattern();
+ }
public Class[] getAnnotatedClasses() {
return new Class[]{
14 years, 8 months
Hibernate SVN: r17739 - in annotations/branches/v3_3_1_GA_CP/src/test: org/hibernate/test/annotations/query and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-10-14 02:08:44 -0400 (Wed, 14 Oct 2009)
New Revision: 17739
Modified:
annotations/branches/v3_3_1_GA_CP/src/test/hibernate.properties
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/query/QueryAndSQLTest.java
Log:
JBPAPP-1796 Modify Annotations, Entity Manager, and Search to work with the same property settings as Core
Modified: annotations/branches/v3_3_1_GA_CP/src/test/hibernate.properties
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/hibernate.properties 2009-10-14 05:37:23 UTC (rev 17738)
+++ annotations/branches/v3_3_1_GA_CP/src/test/hibernate.properties 2009-10-14 06:08:44 UTC (rev 17739)
@@ -4,17 +4,15 @@
## define query language constants / function names
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
+hibernate.query.substitutions yes 'Y', no 'N'
## select the classic query parser
#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
-hibernate.format_sql true
-
#################
### Platforms ###
#################
@@ -32,10 +30,21 @@
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.username sa
hibernate.connection.password
-hibernate.connection.url jdbc:hsqldb:hsql://localhost
-hibernate.connection.url jdbc:hsqldb:test
-hibernate.connection.url jdbc:hsqldb:.
+hibernate.connection.url jdbc:hsqldb:./build/db/hsqldb/hibernate
+#hibernate.connection.url jdbc:hsqldb:hsql://localhost
+#hibernate.connection.url jdbc:hsqldb:test
+## H2 (www.h2database.com)
+#hibernate.dialect org.hibernate.dialect.H2Dialect
+#hibernate.connection.driver_class org.h2.Driver
+#hibernate.connection.username sa
+#hibernate.connection.password
+#hibernate.connection.url jdbc:h2:mem:./build/db/h2/hibernate
+#hibernate.connection.url jdbc:h2:testdb/h2test
+#hibernate.connection.url jdbc:h2:mem:imdb1
+#hibernate.connection.url jdbc:h2:tcp://dbserv:8084/sample;
+#hibernate.connection.url jdbc:h2:ssl://secureserv:8085/sample;
+#hibernate.connection.url jdbc:h2:ssl://secureserv/testdb;cipher=AES
## MySQL
@@ -44,39 +53,42 @@
#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
#hibernate.connection.driver_class com.mysql.jdbc.Driver
#hibernate.connection.url jdbc:mysql:///test
-#hibernate.connection.username emmanuel
-#hibernate.connection.password hibernate
+#hibernate.connection.username gavin
+#hibernate.connection.password
## Oracle
-#hibernate.dialect org.hibernate.dialect.OracleDialect
-#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
+#hibernate.dialect org.hibernate.dialect.Oracle8iDialect
+#hibernate.dialect org.hibernate.dialect.Oracle9iDialect
+#hibernate.dialect org.hibernate.dialect.Oracle10gDialect
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
#hibernate.connection.username ora
#hibernate.connection.password ora
-#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl
+#hibernate.connection.url jdbc:oracle:thin:@localhost:1522:XE
## PostgreSQL
#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
#hibernate.connection.driver_class org.postgresql.Driver
-#hibernate.connection.url jdbc:postgresql:annotations
-#hibernate.connection.username postgres
-#hibernate.connection.password hibernate
-#hibernate.query.substitutions yes 'Y', no 'N'
+#hibernate.connection.url jdbc:postgresql:template1
+#hibernate.connection.username pg
+#hibernate.connection.password
## DB2
#hibernate.dialect org.hibernate.dialect.DB2Dialect
+#hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2:test
+#hibernate.connection.url jdbc:db2://localhost:50000/somename
+#hibernate.connection.url jdbc:db2:somename
#hibernate.connection.username db2
#hibernate.connection.password db2
-## TimesTen (not supported yet)
+## TimesTen
#hibernate.dialect org.hibernate.dialect.TimesTenDialect
#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
@@ -99,13 +111,13 @@
#hibernate.connection.url jdbc:as400://systemname
-## Derby (Not supported!)
+## Derby (not supported!)
#hibernate.dialect org.hibernate.dialect.DerbyDialect
#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
#hibernate.connection.username
#hibernate.connection.password
-#hibernate.connection.url jdbc:derby:/test;create=true
+#hibernate.connection.url jdbc:derby:build/db/derby/hibernate;create=true
## Sybase
@@ -122,7 +134,7 @@
#hibernate.dialect org.hibernate.dialect.MckoiDialect
#hibernate.connection.driver_class com.mckoi.JDBCDriver
#hibernate.connection.url jdbc:mckoi:///
-#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
+#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.0.3/db.conf
#hibernate.connection.username admin
#hibernate.connection.password nimda
@@ -159,6 +171,10 @@
#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
+## The New Microsoft Driver
+#hibernate.connection.driver_class com.microsoft.sqlserver.jdbc.SQLServerDriver
+#hibernate.connection.url jdbc:sqlserver://localhost
+
## jTDS (since version 0.9)
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
@@ -191,7 +207,42 @@
#hibernate.connection.password PBPUBLIC
+## Ingres
+## older versions (before Ingress 2006)
+
+#hibernate.dialect org.hibernate.dialect.IngresDialect
+#hibernate.connection.driver_class ca.edbc.jdbc.EdbcDriver
+#hibernate.connection.url jdbc:edbc://localhost:II7/database
+#hibernate.connection.username user
+#hibernate.connection.password password
+
+## Ingres 2006 or later
+
+#hibernate.dialect org.hibernate.dialect.IngresDialect
+#hibernate.connection.driver_class com.ingres.jdbc.IngresDriver
+#hibernate.connection.url jdbc:ingres://localhost:II7/database;CURSOR=READONLY;auto=multi
+#hibernate.connection.username user
+#hibernate.connection.password password
+
+## Mimer SQL
+
+#hibernate.dialect org.hibernate.dialect.MimerSQLDialect
+#hibernate.connection.driver_class com.mimer.jdbc.Driver
+#hibernate.connection.url jdbc:mimer:multi1
+#hibernate.connection.username hibernate
+#hibernate.connection.password hibernate
+
+
+## InterSystems Cache
+
+#hibernate.dialect org.hibernate.dialect.Cache71Dialect
+#hibernate.connection.driver_class com.intersys.jdbc.CacheDriver
+#hibernate.connection.username _SYSTEM
+#hibernate.connection.password SYS
+#hibernate.connection.url jdbc:Cache://127.0.0.1:1972/HIBERNATE
+
+
#################################
### Hibernate Connection Pool ###
#################################
@@ -239,7 +290,6 @@
#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
@@ -294,6 +344,11 @@
#hibernate.show_sql true
+## format SQL in log and console
+
+hibernate.format_sql true
+
+
## add comments to the generated SQL
#hibernate.use_sql_comments true
@@ -309,6 +364,7 @@
#hibernate.hbm2ddl.auto create-drop
#hibernate.hbm2ddl.auto create
#hibernate.hbm2ddl.auto update
+#hibernate.hbm2ddl.auto validate
## specify a default schema and catalog for unqualified tablenames
@@ -319,7 +375,7 @@
## enable ordering of SQL UPDATEs by primary key
-hibernate.order_updates true
+#hibernate.order_updates true
## set the maximum depth of the outer join fetch tree
@@ -329,7 +385,7 @@
## set the default batch size for batch fetching
-hibernate.default_batch_fetch_size 100
+#hibernate.default_batch_fetch_size 8
## rollback generated identifier values of deleted entities to default values
@@ -337,9 +393,9 @@
#hibernate.use_identifer_rollback true
-## enable CGLIB reflection optimizer (enabled by default)
+## enable bytecode reflection optimizer (disabled by default)
-#hibernate.cglib.use_reflection_optimizer false
+#hibernate.bytecode.use_reflection_optimizer true
@@ -364,6 +420,7 @@
## set the maximum JDBC 2 batch size (a nonzero value enables batching)
+#hibernate.jdbc.batch_size 5
#hibernate.jdbc.batch_size 0
@@ -425,7 +482,7 @@
## enable the query cache
-hibernate.cache.use_query_cache true
+#hibernate.cache.use_query_cache true
## store the second-level cache entries in a more human-friendly format
Modified: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/query/QueryAndSQLTest.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/query/QueryAndSQLTest.java 2009-10-14 05:37:23 UTC (rev 17738)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/query/QueryAndSQLTest.java 2009-10-14 06:08:44 UTC (rev 17739)
@@ -9,6 +9,7 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
import org.hibernate.stat.Statistics;
import org.hibernate.test.annotations.A320;
import org.hibernate.test.annotations.A320b;
@@ -377,4 +378,8 @@
"org/hibernate/test/annotations/query/orm.xml"
};
}
+
+ protected void configure(Configuration cfg) {
+ cfg.setProperty( "hibernate.cache.use_query_cache", "true" );
+ }
}
14 years, 8 months
Hibernate SVN: r17738 - in annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id: sequences and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-10-14 01:37:23 -0400 (Wed, 14 Oct 2009)
New Revision: 17738
Added:
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdTest.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/UUIDGenerator.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Ball.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/BreakDance.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Bunny.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Computer.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Department.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Dog.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FirTree.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Footballer.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FootballerPk.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Furniture.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/GoalKeeper.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Home.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Location.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/MilitaryBuilding.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Monkey.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Phone.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Planet.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PlanetCheatSheet.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PointyTooth.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Shoe.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/SoundSystem.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Store.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tower.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tree.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/TwinkleToes.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/package-info.java
Modified:
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Department.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/IdTest.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Phone.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Shoe.java
annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Store.java
Log:
JBPAPP-1061 HHH-4397 Tests using sequences are run on databases which doesn't supports sequences
Modified: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Department.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Department.java 2009-10-14 05:32:56 UTC (rev 17737)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Department.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -2,9 +2,9 @@
package org.hibernate.test.annotations.id;
import java.io.Serializable;
+
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
@@ -17,11 +17,7 @@
private Long id;
@Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_DEPT")
- @javax.persistence.SequenceGenerator(
- name = "SEQ_DEPT",
- sequenceName = "my_sequence"
- )
+ @GeneratedValue
public Long getId() {
return id;
}
Modified: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/IdTest.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/IdTest.java 2009-10-14 05:32:56 UTC (rev 17737)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/IdTest.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -10,7 +10,6 @@
* @author Emmanuel Bernard
*/
public class IdTest extends TestCase {
- //FIXME split Sequence and Id tests to explicit the run failure on Oracle etc
public IdTest(String x) {
super( x );
Modified: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Phone.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Phone.java 2009-10-14 05:32:56 UTC (rev 17737)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Phone.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -3,7 +3,6 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
@@ -14,11 +13,7 @@
private Integer id;
@Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Phone_Gen")
- @javax.persistence.SequenceGenerator(
- name = "Phone_Gen",
- sequenceName = "phone_seq"
- )
+ @GeneratedValue
public Integer getId() {
return id;
}
Modified: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Shoe.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Shoe.java 2009-10-14 05:32:56 UTC (rev 17737)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Shoe.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -2,9 +2,9 @@
package org.hibernate.test.annotations.id;
import java.io.Serializable;
+
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
@@ -17,7 +17,7 @@
private Long id;
@Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN")
+ @GeneratedValue
public Long getId() {
return id;
}
Modified: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Store.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Store.java 2009-10-14 05:32:56 UTC (rev 17737)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/Store.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -2,9 +2,9 @@
package org.hibernate.test.annotations.id;
import java.io.Serializable;
+
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
@@ -13,15 +13,11 @@
* @author Emmanuel Bernard
*/
@Entity
-(a)javax.persistence.SequenceGenerator(
- name = "SEQ_STORE",
- sequenceName = "my_sequence"
-)
public class Store implements Serializable {
private Long id;
@Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
+ @GeneratedValue
public Long getId() {
return id;
}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,64 @@
+//$Id: EnumIdTest.java 14785 2008-06-19 10:44:33Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.test.annotations.TestCase;
+import org.hibernate.test.annotations.id.sequences.entities.Planet;
+import org.hibernate.test.annotations.id.sequences.entities.PlanetCheatSheet;
+
+
+
+/**
+ * Tests for enum type as id.
+ *
+ * @author Hardy Ferentschik
+ * @see ANN-744
+ */
+@SuppressWarnings("unchecked")
+public class EnumIdTest extends TestCase {
+
+ private Log log = LogFactory.getLog(EnumIdTest.class);
+
+ public EnumIdTest(String x) {
+ super(x);
+ }
+
+ public void testEnumAsId() throws Exception {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ PlanetCheatSheet mercury = new PlanetCheatSheet();
+ mercury.setPlanet(Planet.MERCURY);
+ mercury.setMass(3.303e+23);
+ mercury.setRadius(2.4397e6);
+ mercury.setNumberOfInhabitants(0);
+ s.persist(mercury);
+ tx.commit();
+ s.close();
+
+ s = openSession();
+ tx = s.beginTransaction();
+ PlanetCheatSheet mercuryFromDb = (PlanetCheatSheet) s.get(PlanetCheatSheet.class, mercury.getPlanet());
+ assertNotNull(mercuryFromDb);
+ log.debug(mercuryFromDb.toString());
+ s.delete(mercuryFromDb);
+ tx.commit();
+ s.close();
+
+ s = openSession();
+ tx = s.beginTransaction();
+ mercury = (PlanetCheatSheet) s.get(PlanetCheatSheet.class, Planet.MERCURY);
+ assertNull(mercury);
+ tx.commit();
+ s.close();
+ }
+
+ /**
+ * @see org.hibernate.test.annotations.TestCase#getMappings()
+ */
+ protected Class[] getMappings() {
+ return new Class[] { PlanetCheatSheet.class };
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,39 @@
+//$Id: IdClassTest.java 14784 2008-06-19 10:42:20Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.test.annotations.TestCase;
+import org.hibernate.test.annotations.id.sequences.entities.Location;
+import org.hibernate.test.annotations.id.sequences.entities.Tower;
+
+
+/**
+ * @author Emmanuel Bernard
+ */
+@SuppressWarnings("unchecked")
+public class IdClassTest extends TestCase {
+
+ public void testIdClassInSuperclass() throws Exception {
+ Tower tower = new Tower();
+ tower.latitude = 10.3;
+ tower.longitude = 45.4;
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ s.persist( tower );
+ s.flush();
+ s.clear();
+ Location loc = new Location();
+ loc.latitude = tower.latitude;
+ loc.longitude = tower.longitude;
+ assertNotNull( s.get( Tower.class, loc ) );
+ tx.rollback();
+ s.close();
+ }
+
+ protected Class[] getMappings() {
+ return new Class[]{
+ Tower.class
+ };
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdTest.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdTest.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdTest.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,308 @@
+//$Id: IdTest.java 15025 2008-08-11 09:14:39Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.mapping.Column;
+import org.hibernate.test.annotations.TestCase;
+import org.hibernate.test.annotations.id.sequences.entities.Ball;
+import org.hibernate.test.annotations.id.sequences.entities.BreakDance;
+import org.hibernate.test.annotations.id.sequences.entities.Computer;
+import org.hibernate.test.annotations.id.sequences.entities.Department;
+import org.hibernate.test.annotations.id.sequences.entities.Dog;
+import org.hibernate.test.annotations.id.sequences.entities.FirTree;
+import org.hibernate.test.annotations.id.sequences.entities.Footballer;
+import org.hibernate.test.annotations.id.sequences.entities.FootballerPk;
+import org.hibernate.test.annotations.id.sequences.entities.Furniture;
+import org.hibernate.test.annotations.id.sequences.entities.GoalKeeper;
+import org.hibernate.test.annotations.id.sequences.entities.Home;
+import org.hibernate.test.annotations.id.sequences.entities.Monkey;
+import org.hibernate.test.annotations.id.sequences.entities.Phone;
+import org.hibernate.test.annotations.id.sequences.entities.Shoe;
+import org.hibernate.test.annotations.id.sequences.entities.SoundSystem;
+import org.hibernate.test.annotations.id.sequences.entities.Store;
+import org.hibernate.test.annotations.id.sequences.entities.Tree;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@SuppressWarnings("unchecked")
+public class IdTest extends TestCase {
+ public void testGenericGenerator() throws Exception {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ SoundSystem system = new SoundSystem();
+ system.setBrand("Genelec");
+ system.setModel("T234");
+ Furniture fur = new Furniture();
+ s.persist(system);
+ s.persist(fur);
+ tx.commit();
+ s.close();
+
+ s = openSession();
+ tx = s.beginTransaction();
+ system = (SoundSystem) s.get(SoundSystem.class, system.getId());
+ fur = (Furniture) s.get(Furniture.class, fur.getId());
+ assertNotNull(system);
+ assertNotNull(fur);
+ s.delete(system);
+ s.delete(fur);
+ tx.commit();
+ s.close();
+
+ }
+
+ /*
+ * Ensures that GenericGenerator annotations wrapped inside a
+ * GenericGenerators holder are bound correctly
+ */
+ public void testGenericGenerators() throws Exception {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ Monkey monkey = new Monkey();
+ s.persist(monkey);
+ s.flush();
+ assertNotNull(monkey.getId());
+ tx.rollback();
+ s.close();
+ }
+
+ public void testTableGenerator() throws Exception {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+
+ Ball b = new Ball();
+ Dog d = new Dog();
+ Computer c = new Computer();
+ s.persist(b);
+ s.persist(d);
+ s.persist(c);
+ tx.commit();
+ s.close();
+ assertEquals("table id not generated", new Integer(1), b.getId());
+ assertEquals("generator should not be shared", new Integer(1), d
+ .getId());
+ assertEquals("default value should work", new Long(1), c.getId());
+
+ s = openSession();
+ tx = s.beginTransaction();
+ s.delete(s.get(Ball.class, new Integer(1)));
+ s.delete(s.get(Dog.class, new Integer(1)));
+ s.delete(s.get(Computer.class, new Long(1)));
+ tx.commit();
+ s.close();
+ }
+
+ public void testSequenceGenerator() throws Exception {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ Shoe b = new Shoe();
+ s.persist(b);
+ tx.commit();
+ s.close();
+ assertNotNull(b.getId());
+
+ s = openSession();
+ tx = s.beginTransaction();
+ s.delete(s.get(Shoe.class, b.getId()));
+ tx.commit();
+ s.close();
+ }
+
+ public void testClassLevelGenerator() throws Exception {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ Store b = new Store();
+ s.persist(b);
+ tx.commit();
+ s.close();
+ assertNotNull(b.getId());
+
+ s = openSession();
+ tx = s.beginTransaction();
+ s.delete(s.get(Store.class, b.getId()));
+ tx.commit();
+ s.close();
+ }
+
+ public void testMethodLevelGenerator() throws Exception {
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ Department b = new Department();
+ s.persist(b);
+ tx.commit();
+ s.close();
+ assertNotNull(b.getId());
+
+ s = openSession();
+ tx = s.beginTransaction();
+ s.delete(s.get(Department.class, b.getId()));
+ tx.commit();
+ s.close();
+ }
+
+ public void testDefaultSequence() throws Exception {
+ Session s;
+ Transaction tx;
+ s = openSession();
+ tx = s.beginTransaction();
+ Home h = new Home();
+ s.persist(h);
+ tx.commit();
+ s.close();
+ assertNotNull(h.getId());
+
+ s = openSession();
+ tx = s.beginTransaction();
+ Home reloadedHome = (Home) s.get(Home.class, h.getId());
+ assertEquals(h.getId(), reloadedHome.getId());
+ s.delete(reloadedHome);
+ tx.commit();
+ s.close();
+ }
+
+ public void testParameterizedAuto() throws Exception {
+ Session s;
+ Transaction tx;
+ s = openSession();
+ tx = s.beginTransaction();
+ Home h = new Home();
+ s.persist(h);
+ tx.commit();
+ s.close();
+ assertNotNull(h.getId());
+
+ s = openSession();
+ tx = s.beginTransaction();
+ Home reloadedHome = (Home) s.get(Home.class, h.getId());
+ assertEquals(h.getId(), reloadedHome.getId());
+ s.delete(reloadedHome);
+ tx.commit();
+ s.close();
+ }
+
+ public void testIdInEmbeddableSuperclass() throws Exception {
+ Session s;
+ Transaction tx;
+ s = openSession();
+ tx = s.beginTransaction();
+ FirTree chrismasTree = new FirTree();
+ s.persist(chrismasTree);
+ tx.commit();
+ s.clear();
+ tx = s.beginTransaction();
+ chrismasTree = (FirTree) s.get(FirTree.class, chrismasTree.getId());
+ assertNotNull(chrismasTree);
+ s.delete(chrismasTree);
+ tx.commit();
+ s.close();
+ }
+
+ public void testIdClass() throws Exception {
+ Session s;
+ Transaction tx;
+ s = openSession();
+ tx = s.beginTransaction();
+ Footballer fb = new Footballer("David", "Beckam", "Arsenal");
+ GoalKeeper keeper = new GoalKeeper("Fabien", "Bartez", "OM");
+ s.persist(fb);
+ s.persist(keeper);
+ tx.commit();
+ s.clear();
+
+ // lookup by id
+ tx = s.beginTransaction();
+ FootballerPk fpk = new FootballerPk("David", "Beckam");
+ fb = (Footballer) s.get(Footballer.class, fpk);
+ FootballerPk fpk2 = new FootballerPk("Fabien", "Bartez");
+ keeper = (GoalKeeper) s.get(GoalKeeper.class, fpk2);
+ assertNotNull(fb);
+ assertNotNull(keeper);
+ assertEquals("Beckam", fb.getLastname());
+ assertEquals("Arsenal", fb.getClub());
+ assertEquals(1, s.createQuery(
+ "from Footballer f where f.firstname = 'David'").list().size());
+ tx.commit();
+
+ // reattach by merge
+ tx = s.beginTransaction();
+ fb.setClub("Bimbo FC");
+ s.merge(fb);
+ tx.commit();
+
+ // reattach by saveOrUpdate
+ tx = s.beginTransaction();
+ fb.setClub("Bimbo FC SA");
+ s.saveOrUpdate(fb);
+ tx.commit();
+
+ // clean up
+ s.clear();
+ tx = s.beginTransaction();
+ fpk = new FootballerPk("David", "Beckam");
+ fb = (Footballer) s.get(Footballer.class, fpk);
+ assertEquals("Bimbo FC SA", fb.getClub());
+ s.delete(fb);
+ s.delete(keeper);
+ tx.commit();
+ s.close();
+ }
+
+ public void testColumnDefinition() {
+ Column idCol = (Column) getCfg().getClassMapping(Ball.class.getName())
+ .getIdentifierProperty().getValue().getColumnIterator().next();
+ assertEquals("ball_id", idCol.getName());
+ }
+
+ public void testLowAllocationSize() throws Exception {
+ Session s;
+ Transaction tx;
+ s = openSession();
+ tx = s.beginTransaction();
+ int size = 4;
+ BreakDance[] bds = new BreakDance[size];
+ for (int i = 0; i < size; i++) {
+ bds[i] = new BreakDance();
+ s.persist(bds[i]);
+ }
+ s.flush();
+ for (int i = 0; i < size; i++) {
+ assertEquals(i + 1, bds[i].id.intValue());
+ }
+ tx.rollback();
+ s.close();
+ }
+
+
+
+ @Override
+ protected boolean runForCurrentDialect() {
+ return super.runForCurrentDialect() && getDialect().supportsSequences();
+ }
+
+ /**
+ * @see org.hibernate.test.annotations.TestCase#getMappings()
+ */
+ protected Class[] getMappings() {
+ return new Class[] { Ball.class, Shoe.class, Store.class,
+ Department.class, Dog.class, Computer.class, Home.class,
+ Phone.class, Tree.class, FirTree.class, Footballer.class,
+ SoundSystem.class, Furniture.class, GoalKeeper.class,
+ BreakDance.class, Monkey.class};
+ }
+
+ /**
+ * @see org.hibernate.test.annotations.TestCase#getAnnotatedPackages()
+ */
+ protected String[] getAnnotatedPackages() {
+ return new String[] { "org.hibernate.test.annotations",
+ "org.hibernate.test.annotations.id" };
+ }
+
+ @Override
+ protected String[] getXmlFiles() {
+ return new String[] { "org/hibernate/test/annotations/orm.xml" };
+ }
+
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,66 @@
+//$Id: JoinColumnOverrideTest.java 14761 2008-06-11 13:51:06Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.dialect.SQLServerDialect;
+import org.hibernate.test.annotations.TestCase;
+import org.hibernate.test.annotations.id.sequences.entities.Bunny;
+import org.hibernate.test.annotations.id.sequences.entities.PointyTooth;
+import org.hibernate.test.annotations.id.sequences.entities.TwinkleToes;
+
+
+
+/**
+ * Tests for JIRA issue ANN-748.
+ *
+ * @author Hardy Ferentschik
+ */
+@SuppressWarnings("unchecked")
+public class JoinColumnOverrideTest extends TestCase {
+
+ private Log log = LogFactory.getLog(JoinColumnOverrideTest.class);
+
+ public JoinColumnOverrideTest(String x) {
+ super(x);
+ }
+
+ public void testBlownPrecision() throws Exception {
+
+ try {
+ AnnotationConfiguration config = new AnnotationConfiguration();
+ config.addAnnotatedClass(Bunny.class);
+ config.addAnnotatedClass(PointyTooth.class);
+ config.addAnnotatedClass(TwinkleToes.class);
+ config.buildSessionFactory();
+ String[] schema = config
+ .generateSchemaCreationScript(new SQLServerDialect());
+ for (String s : schema) {
+ log.debug(s);
+ }
+ String expectedSqlPointyTooth = "create table PointyTooth (id numeric(128,0) not null, " +
+ "bunny_id numeric(128,0) null, primary key (id))";
+ assertEquals("Wrong SQL", expectedSqlPointyTooth, schema[1]);
+
+ String expectedSqlTwinkleToes = "create table TwinkleToes (id numeric(128,0) not null, " +
+ "bunny_id numeric(128,0) null, primary key (id))";
+ assertEquals("Wrong SQL", expectedSqlTwinkleToes, schema[2]);
+ } catch (Exception e) {
+ StringWriter writer = new StringWriter();
+ e.printStackTrace(new PrintWriter(writer));
+ log.debug(writer.toString());
+ fail(e.getMessage());
+ }
+ }
+
+ /**
+ * @see org.hibernate.test.annotations.TestCase#getMappings()
+ */
+ protected Class[] getMappings() {
+ return new Class[] {};
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/UUIDGenerator.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/UUIDGenerator.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/UUIDGenerator.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,34 @@
+package org.hibernate.test.annotations.id.sequences;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.UUID;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.SessionImplementor;
+import org.hibernate.id.IdentifierGenerator;
+
+/**
+ * Unlike Hibernate's UUID generator. This avoids
+ * meaningless synchronization and has less
+ * than a chance of an asteroid hitting you on the head
+ * even after trillions of rows are inserted. I know
+ * this to be true because it says so in Wikipedia(haha).
+ * http://en.wikipedia.org/wiki/UUID#Random_UUID_probability_of_duplicates
+ *
+ */
+public class UUIDGenerator implements IdentifierGenerator {
+
+ public Serializable generate(SessionImplementor arg0, Object arg1) throws HibernateException {
+ UUID uuid = UUID.randomUUID();
+ String sud = uuid.toString();
+ System.out.println("uuid="+uuid);
+ sud = sud.replaceAll("-", "");
+
+ BigInteger integer = new BigInteger(sud,16);
+
+ System.out.println("bi ="+integer.toString() );
+ return integer;
+ }
+
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Ball.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Ball.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Ball.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,35 @@
+//$Id: Ball.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.TableGenerator;
+
+/**
+ * Sample of table generator
+ *
+ * @author Emmanuel Bernard
+ */
+@TableGenerator(name = "EMP_GEN", table = "GENERATOR_TABLE", pkColumnName = "pkey",
+ valueColumnName = "hi", pkColumnValue = "Ball", allocationSize = 10)
+@Entity
+@SuppressWarnings("serial")
+public class Ball implements Serializable {
+ private Integer id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "EMP_GEN")
+ @Column(name = "ball_id")
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/BreakDance.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/BreakDance.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/BreakDance.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,27 @@
+//$Id: BreakDance.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.TableGenerator;
+import javax.persistence.GenerationType;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class BreakDance {
+ @Id
+ @GeneratedValue(generator = "memencoIdGen", strategy = GenerationType.TABLE)
+ @TableGenerator(
+ name = "memencoIdGen",
+ table = "hi_id_key",
+ pkColumnName = "id_key",
+ valueColumnName = "next_hi",
+ pkColumnValue = "issue",
+ allocationSize = 1
+ )
+ public Integer id;
+ public String name;
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Bunny.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Bunny.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Bunny.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,46 @@
+//$Id: Bunny.java 14761 2008-06-11 13:51:06Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * Blown precision on related entity when @JoinColumn is used.
+ *
+ * @see ANN-748
+ * @author Andrew C. Oliver andyspam(a)osintegrators.com
+ */
+@Entity
+@SuppressWarnings("serial")
+public class Bunny implements Serializable {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "java5_uuid")
+ @GenericGenerator(name = "java5_uuid", strategy = "org.hibernate.test.annotations.id.UUIDGenerator")
+ @Column(name = "id", precision = 128, scale = 0)
+ private BigInteger id;
+
+ @OneToMany(mappedBy = "bunny", cascade = { CascadeType.PERSIST })
+ Set<PointyTooth> teeth;
+
+ @OneToMany(mappedBy = "bunny", cascade = { CascadeType.PERSIST })
+ Set<TwinkleToes> toes;
+
+ public void setTeeth(Set<PointyTooth> teeth) {
+ this.teeth = teeth;
+ }
+
+ public BigInteger getId() {
+ return id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Computer.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Computer.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Computer.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,34 @@
+//$Id: Computer.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity()
+public class Computer {
+ private Long id;
+ private String serialNumber;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getSerialNumber() {
+ return serialNumber;
+ }
+
+ public void setSerialNumber(String serialNumber) {
+ this.serialNumber = serialNumber;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Department.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Department.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Department.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,33 @@
+//$Id: Department.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * Sample of method generator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+@SuppressWarnings("serial")
+public class Department implements Serializable {
+ private Long id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_DEPT")
+ @javax.persistence.SequenceGenerator(
+ name = "SEQ_DEPT",
+ sequenceName = "my_sequence"
+ )
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long long1) {
+ id = long1;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Dog.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Dog.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Dog.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,42 @@
+//$Id: Dog.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+/**
+ * Share the generator table decribed by the GEN_TABLE GeneratedIdTable
+ * using the Dog key as discriminator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+@Table(name = "tbl_dog")
+@TableGenerator(name = "DogGen", table = "GENERATOR_TABLE", pkColumnName = "pkey",
+ valueColumnName = "hi", pkColumnValue = "Dog", allocationSize = 10)
+public class Dog {
+ private Integer id;
+ private String name;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "DogGen")
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FirTree.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FirTree.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FirTree.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,11 @@
+//$Id: FirTree.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class FirTree extends Tree {
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Footballer.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Footballer.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Footballer.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,73 @@
+//$Id: Footballer.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+(a)IdClass(FootballerPk.class)
+@DiscriminatorColumn(name = "bibi")
+public class Footballer {
+ private String firstname;
+ private String lastname;
+ private String club;
+
+ public Footballer() {
+ }
+
+ public Footballer(String firstname, String lastname, String club) {
+ this.firstname = firstname;
+ this.lastname = lastname;
+ this.club = club;
+ }
+
+ public boolean equals(Object o) {
+ if ( this == o ) return true;
+ if ( !( o instanceof Footballer ) ) return false;
+
+ final Footballer footballer = (Footballer) o;
+
+ if ( !firstname.equals( footballer.firstname ) ) return false;
+ if ( !lastname.equals( footballer.lastname ) ) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = firstname.hashCode();
+ result = 29 * result + lastname.hashCode();
+ return result;
+ }
+
+ @Id
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ @Id
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public String getClub() {
+ return club;
+ }
+
+ public void setClub(String club) {
+ this.club = club;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FootballerPk.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FootballerPk.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/FootballerPk.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,62 @@
+//$Id: FootballerPk.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Embeddable
+@SuppressWarnings("serial")
+public class FootballerPk implements Serializable {
+ private String firstname;
+ private String lastname;
+
+ @Column(name = "fb_fname")
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public FootballerPk() {
+ }
+
+ public FootballerPk(String firstname, String lastname) {
+ this.firstname = firstname;
+ this.lastname = lastname;
+
+ }
+
+ public boolean equals(Object o) {
+ if ( this == o ) return true;
+ if ( !( o instanceof FootballerPk ) ) return false;
+
+ final FootballerPk footballerPk = (FootballerPk) o;
+
+ if ( !firstname.equals( footballerPk.firstname ) ) return false;
+ if ( !lastname.equals( footballerPk.lastname ) ) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = firstname.hashCode();
+ result = 29 * result + lastname.hashCode();
+ return result;
+ }
+
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Furniture.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Furniture.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Furniture.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,33 @@
+//$Id: Furniture.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.Parameter;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Furniture {
+ private Integer id;
+
+ @Id
+ @GeneratedValue(generator = "hibseq")
+ @GenericGenerator(name = "hibseq", strategy = "seqhilo",
+ parameters = {
+ @Parameter(name = "max_lo", value = "5"),
+ @Parameter(name = "sequence", value = "heybabyhey")
+ }
+ )
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/GoalKeeper.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/GoalKeeper.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/GoalKeeper.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,17 @@
+//$Id: GoalKeeper.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class GoalKeeper extends Footballer {
+ public GoalKeeper() {
+ }
+
+ public GoalKeeper(String firstname, String lastname, String club) {
+ super( firstname, lastname, club );
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Home.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Home.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Home.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,26 @@
+//$Id: Home.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * Default sequence generation usage
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Home {
+ private Long id;
+
+ @Id
+ @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Location.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Location.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Location.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,35 @@
+//$Id: Location.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@SuppressWarnings("serial")
+public class Location implements Serializable {
+ public double longitude;
+ public double latitude;
+
+ public boolean equals(Object o) {
+ if ( this == o ) return true;
+ if ( o == null || getClass() != o.getClass() ) return false;
+
+ final Location location = (Location) o;
+
+ if ( Double.compare( location.latitude, latitude ) != 0 ) return false;
+ if ( Double.compare( location.longitude, longitude ) != 0 ) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ long temp;
+ temp = longitude != +0.0d ? Double.doubleToLongBits( longitude ) : 0L;
+ result = (int) ( temp ^ ( temp >>> 32 ) );
+ temp = latitude != +0.0d ? Double.doubleToLongBits( latitude ) : 0L;
+ result = 29 * result + (int) ( temp ^ ( temp >>> 32 ) );
+ return result;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/MilitaryBuilding.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/MilitaryBuilding.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/MilitaryBuilding.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,18 @@
+//$Id: MilitaryBuilding.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.MappedSuperclass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@MappedSuperclass
+(a)IdClass(Location.class)
+public class MilitaryBuilding {
+ @Id
+ public double longitude;
+ @Id
+ public double latitude;
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Monkey.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Monkey.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Monkey.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,24 @@
+//$
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Paul Cowan
+ */
+@Entity
+public class Monkey {
+ private String id;
+
+ @Id
+ @GeneratedValue(generator = "system-uuid-2")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Phone.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Phone.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Phone.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,29 @@
+//$Id: Phone.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity()
+public class Phone {
+ private Integer id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Phone_Gen")
+ @javax.persistence.SequenceGenerator(
+ name = "Phone_Gen",
+ sequenceName = "phone_seq"
+ )
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Planet.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Planet.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Planet.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,6 @@
+// $Id: Planet.java 14785 2008-06-19 10:44:33Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+public enum Planet {
+ MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO;
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PlanetCheatSheet.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PlanetCheatSheet.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PlanetCheatSheet.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,85 @@
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+
+
+/**
+ * Test entity for enum type as id.
+ *
+ * @author Hardy Ferentschik
+ * @see ANN-744
+ */
+@Entity
+public class PlanetCheatSheet {
+
+ @Id
+ @Enumerated(EnumType.STRING)
+ @Column(name = "planet")
+ private Planet planet;
+
+ private double mass;
+
+ private double radius;
+
+ private long numberOfInhabitants;
+
+ public Planet getPlanet() {
+ return planet;
+ }
+
+ public void setPlanet(Planet planet) {
+ this.planet = planet;
+ }
+
+ public double getMass() {
+ return mass;
+ }
+
+ public void setMass(double mass) {
+ this.mass = mass;
+ }
+
+ public double getRadius() {
+ return radius;
+ }
+
+ public void setRadius(double radius) {
+ this.radius = radius;
+ }
+
+ public long getNumberOfInhabitants() {
+ return numberOfInhabitants;
+ }
+
+ public void setNumberOfInhabitants(long numberOfInhabitants) {
+ this.numberOfInhabitants = numberOfInhabitants;
+ }
+
+ /**
+ * Constructs a <code>String</code> with all attributes
+ * in name = value format.
+ *
+ * @return a <code>String</code> representation
+ * of this object.
+ */
+ public String toString()
+ {
+ final String TAB = " ";
+
+ String retValue = "";
+
+ retValue = "PlanetCheatSheet ( "
+ + super.toString() + TAB
+ + "planet = " + this.planet + TAB
+ + "mass = " + this.mass + TAB
+ + "radius = " + this.radius + TAB
+ + "numberOfInhabitants = " + this.numberOfInhabitants + TAB
+ + " )";
+
+ return retValue;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PointyTooth.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PointyTooth.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/PointyTooth.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,44 @@
+//$Id: PointyTooth.java 14761 2008-06-11 13:51:06Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * Blown precision on related entity when @JoinColumn is used.
+ * Does not cause an issue on HyperSonic, but replicates nicely on PGSQL.
+ *
+ * @see ANN-748
+ * @author Andrew C. Oliver andyspam(a)osintegrators.com
+ */
+@Entity
+@SuppressWarnings("serial")
+public class PointyTooth implements Serializable {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "java5_uuid")
+ @GenericGenerator(name = "java5_uuid", strategy = "org.hibernate.test.annotations.id.UUIDGenerator")
+ @Column(name = "id", precision = 128, scale = 0)
+ private BigInteger id;
+
+ @ManyToOne
+ @JoinColumn(name = "bunny_id")
+ Bunny bunny;
+
+ public void setBunny(Bunny bunny) {
+ this.bunny = bunny;
+ }
+
+ public BigInteger getId() {
+ return id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Shoe.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Shoe.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Shoe.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,29 @@
+//$Id: Shoe.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * sample of Sequance generator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+@SuppressWarnings("serial")
+public class Shoe implements Serializable {
+ private Long id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long long1) {
+ id = long1;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/SoundSystem.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/SoundSystem.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/SoundSystem.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,42 @@
+//$Id: SoundSystem.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class SoundSystem {
+ private String id;
+ private String brand;
+ private String model;
+
+ @Id
+ @GeneratedValue(generator = "system-uuid")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getBrand() {
+ return brand;
+ }
+
+ public void setBrand(String brand) {
+ this.brand = brand;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Store.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Store.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Store.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,33 @@
+//$Id: Store.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * Sample of class generator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+(a)javax.persistence.SequenceGenerator(
+ name = "SEQ_STORE",
+ sequenceName = "my_sequence"
+)
+@SuppressWarnings("serial")
+public class Store implements Serializable {
+ private Long id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long long1) {
+ id = long1;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tower.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tower.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tower.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,14 @@
+//$Id: Tower.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+@AttributeOverride(name = "longitude", column = @Column(name = "fld_longitude"))
+public class Tower extends MilitaryBuilding {
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tree.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tree.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/Tree.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,24 @@
+//$Id: Tree.java 14760 2008-06-11 07:33:15Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@MappedSuperclass
+public class Tree {
+ private Integer id;
+
+ @Id
+ @GeneratedValue
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/TwinkleToes.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/TwinkleToes.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/entities/TwinkleToes.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,42 @@
+//$Id: TwinkleToes.java 14761 2008-06-11 13:51:06Z hardy.ferentschik $
+package org.hibernate.test.annotations.id.sequences.entities;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * Blown precision on related entity when @JoinColumn is used.
+ * Does not cause an issue on HyperSonic, but replicates nicely on PGSQL.
+ *
+ * @see ANN-748
+ * @author Andrew C. Oliver andyspam(a)osintegrators.com
+ */
+@Entity
+@SuppressWarnings("serial")
+public class TwinkleToes implements Serializable {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "java5_uuid")
+ @GenericGenerator(name = "java5_uuid", strategy = "org.hibernate.test.annotations.id.UUIDGenerator")
+ @Column(name = "id", precision = 128, scale = 0)
+ private BigInteger id;
+
+ @ManyToOne
+ Bunny bunny;
+
+ public void setBunny(Bunny bunny) {
+ this.bunny = bunny;
+ }
+
+ public BigInteger getId() {
+ return id;
+ }
+}
Added: annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/package-info.java
===================================================================
--- annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/package-info.java (rev 0)
+++ annotations/branches/v3_3_1_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/package-info.java 2009-10-14 05:37:23 UTC (rev 17738)
@@ -0,0 +1,11 @@
+//$Id: package-info.java 14736 2008-06-04 14:23:42Z hardy.ferentschik $
+/**
+ * Test package for metatata facilities
+ * It contains an example of package level metadata
+ */
+(a)org.hibernate.annotations.GenericGenerator(name = "system-uuid", strategy = "uuid")
+(a)org.hibernate.annotations.GenericGenerators(
+ @org.hibernate.annotations.GenericGenerator(name = "system-uuid-2", strategy = "uuid")
+)
+package org.hibernate.test.annotations.id.sequences;
+
14 years, 8 months
Hibernate SVN: r17737 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-10-14 01:32:56 -0400 (Wed, 14 Oct 2009)
New Revision: 17737
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/EnumIdTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdClassTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java
Log:
HHH-4397 Split test involving database specific features (like sequence / identity)
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/EnumIdTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/EnumIdTest.java 2009-10-14 05:29:28 UTC (rev 17736)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/EnumIdTest.java 2009-10-14 05:32:56 UTC (rev 17737)
@@ -4,8 +4,8 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.test.annotations.TestCase;
-import org.hibernate.test.annotations.id.entities.Planet;
-import org.hibernate.test.annotations.id.entities.PlanetCheatSheet;
+import org.hibernate.test.annotations.id.sequences.entities.Planet;
+import org.hibernate.test.annotations.id.sequences.entities.PlanetCheatSheet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdClassTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdClassTest.java 2009-10-14 05:29:28 UTC (rev 17736)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdClassTest.java 2009-10-14 05:32:56 UTC (rev 17737)
@@ -4,9 +4,10 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.test.annotations.TestCase;
-import org.hibernate.test.annotations.id.entities.Location;
-import org.hibernate.test.annotations.id.entities.Tower;
+import org.hibernate.test.annotations.id.sequences.entities.Location;
+import org.hibernate.test.annotations.id.sequences.entities.Tower;
+
/**
* @author Emmanuel Bernard
*/
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java 2009-10-14 05:29:28 UTC (rev 17736)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java 2009-10-14 05:32:56 UTC (rev 17737)
@@ -7,9 +7,9 @@
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.test.annotations.TestCase;
-import org.hibernate.test.annotations.id.entities.Bunny;
-import org.hibernate.test.annotations.id.entities.PointyTooth;
-import org.hibernate.test.annotations.id.entities.TwinkleToes;
+import org.hibernate.test.annotations.id.sequences.entities.Bunny;
+import org.hibernate.test.annotations.id.sequences.entities.PointyTooth;
+import org.hibernate.test.annotations.id.sequences.entities.TwinkleToes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
14 years, 8 months
Hibernate SVN: r17736 - annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2009-10-14 01:29:28 -0400 (Wed, 14 Oct 2009)
New Revision: 17736
Modified:
annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java
annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java
annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java
Log:
JBPAPP-1061 HHH-4397 Tests using sequences are run on databases which doesn't supports sequences
Modified: annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java 2009-10-14 05:15:33 UTC (rev 17735)
+++ annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/EnumIdTest.java 2009-10-14 05:29:28 UTC (rev 17736)
@@ -4,8 +4,8 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.test.annotations.TestCase;
-import org.hibernate.test.annotations.id.entities.Planet;
-import org.hibernate.test.annotations.id.entities.PlanetCheatSheet;
+import org.hibernate.test.annotations.id.sequences.entities.Planet;
+import org.hibernate.test.annotations.id.sequences.entities.PlanetCheatSheet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java 2009-10-14 05:15:33 UTC (rev 17735)
+++ annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/IdClassTest.java 2009-10-14 05:29:28 UTC (rev 17736)
@@ -4,9 +4,10 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.test.annotations.TestCase;
-import org.hibernate.test.annotations.id.entities.Location;
-import org.hibernate.test.annotations.id.entities.Tower;
+import org.hibernate.test.annotations.id.sequences.entities.Location;
+import org.hibernate.test.annotations.id.sequences.entities.Tower;
+
/**
* @author Emmanuel Bernard
*/
Modified: annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java 2009-10-14 05:15:33 UTC (rev 17735)
+++ annotations/branches/v3_4_0_GA_CP/src/test/org/hibernate/test/annotations/id/sequences/JoinColumnOverrideTest.java 2009-10-14 05:29:28 UTC (rev 17736)
@@ -7,9 +7,9 @@
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.test.annotations.TestCase;
-import org.hibernate.test.annotations.id.entities.Bunny;
-import org.hibernate.test.annotations.id.entities.PointyTooth;
-import org.hibernate.test.annotations.id.entities.TwinkleToes;
+import org.hibernate.test.annotations.id.sequences.entities.Bunny;
+import org.hibernate.test.annotations.id.sequences.entities.PointyTooth;
+import org.hibernate.test.annotations.id.sequences.entities.TwinkleToes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
14 years, 8 months