Hibernate SVN: r16482 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-04-29 17:18:35 -0400 (Wed, 29 Apr 2009)
New Revision: 16482
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java
Log:
BVAL-150 Fix pathToTraversableObject
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-04-29 17:58:48 UTC (rev 16481)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-04-29 21:18:35 UTC (rev 16482)
@@ -293,7 +293,7 @@
peekCurrentBean(),
peekProperty(),
rootBeanClass,
- peekPropertyPath(),
+ peekParentPath(),
metaConstraint.getElementType()
);
}
@@ -328,6 +328,7 @@
}
private String buildPath(int index) {
+ if (index < 0) return PROPERTY_ROOT;
StringBuilder builder = new StringBuilder();
for ( int i = 0; i <= index; i++ ) {
builder.append( propertyPath.get( i ) );
15 years, 7 months
Hibernate SVN: r16481 - in branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations: inheritance/joined and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-29 13:58:48 -0400 (Wed, 29 Apr 2009)
New Revision: 16481
Added:
branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/Classes.java
Modified:
branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/EmbeddedGenericsTest.java
branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/inheritance/joined/Alarm.java
branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/manytoone/ForestType.java
Log:
JBPAPP-1124 ANN-779 : Oracle/DB2 - Identifier is too long
Added: branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/Classes.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/Classes.java (rev 0)
+++ branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/Classes.java 2009-04-29 17:58:48 UTC (rev 16481)
@@ -0,0 +1,47 @@
+package org.hibernate.test.annotations.generics;
+
+/**
+ * A test case for ANN-494.
+ *
+ * @author Edward Costello
+ * @author Paolo Perrotta
+ */
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.Embeddable;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+import org.hibernate.annotations.CollectionOfElements;
+
+public class Classes {
+
+ @Embeddable
+ public static class Edition<T> {
+ T name;
+ }
+
+ @Entity
+ public static class Book {
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ Long id;
+
+ @Embedded
+ Edition<String> edition;
+ }
+
+ @Entity
+ public static class PopularBook {
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ Long id;
+
+ @CollectionOfElements
+ Set<Edition<String>> editions = new HashSet<Edition<String>>();
+ }
+}
Modified: branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/EmbeddedGenericsTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/EmbeddedGenericsTest.java 2009-04-29 15:31:19 UTC (rev 16480)
+++ branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/generics/EmbeddedGenericsTest.java 2009-04-29 17:58:48 UTC (rev 16481)
@@ -24,13 +24,13 @@
public class EmbeddedGenericsTest extends TestCase {
Session session;
- Edition<String> edition;
+ Classes.Edition<String> edition;
public void setUp() throws Exception {
super.setUp();
session = getSessions().openSession();
session.getTransaction().begin();
- edition = new Edition<String>();
+ edition = new Classes.Edition<String>();
edition.name = "Second";
}
@@ -40,31 +40,31 @@
}
public void testWorksWithGenericEmbedded() {
- Book b = new Book();
+ Classes.Book b = new Classes.Book();
b.edition = edition;
persist( b );
- Book retrieved = (Book)find( Book.class, b.id );
+ Classes.Book retrieved = (Classes.Book)find( Classes.Book.class, b.id );
assertEquals( "Second", retrieved.edition.name );
- clean( Book.class, b.id );
+ clean( Classes.Book.class, b.id );
}
public void testWorksWithGenericCollectionOfElements() {
- PopularBook b = new PopularBook();
+ Classes.PopularBook b = new Classes.PopularBook();
b.editions.add( edition );
persist( b );
- PopularBook retrieved = (PopularBook)find( PopularBook.class, b.id );
+ Classes.PopularBook retrieved = (Classes.PopularBook)find( Classes.PopularBook.class, b.id );
assertEquals( "Second", retrieved.editions.iterator().next().name );
- clean( PopularBook.class, b.id );
+ clean( Classes.PopularBook.class, b.id );
}
protected Class[] getMappings() {
return new Class[]{
- Book.class,
- PopularBook.class
+ Classes.Book.class,
+ Classes.PopularBook.class
};
}
@@ -84,28 +84,4 @@
tx.commit();
}
- @Embeddable
- public static class Edition<T> {
- T name;
- }
-
- @Entity
- public static class Book {
- @Id
- @GeneratedValue(strategy=GenerationType.AUTO)
- Long id;
-
- @Embedded
- Edition<String> edition;
- }
-
- @Entity
- public static class PopularBook {
- @Id
- @GeneratedValue(strategy=GenerationType.AUTO)
- Long id;
-
- @CollectionOfElements
- Set<Edition<String>> editions = new HashSet<Edition<String>>();
- }
}
Modified: branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/inheritance/joined/Alarm.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/inheritance/joined/Alarm.java 2009-04-29 15:31:19 UTC (rev 16480)
+++ branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/inheritance/joined/Alarm.java 2009-04-29 17:58:48 UTC (rev 16481)
@@ -14,7 +14,7 @@
protected EventInformation eventInfo;
@OneToOne
- @JoinColumns({@JoinColumn(name = "EVENTINFORMATIONT_NOTIFICATIONID",
+ @JoinColumns({@JoinColumn(name = "EVENTINFO_NOTIFICATIONID",
referencedColumnName = "NOTIFICATIONID")})
public EventInformation getEventInfo() {
return eventInfo;
Modified: branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/manytoone/ForestType.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/manytoone/ForestType.java 2009-04-29 15:31:19 UTC (rev 16480)
+++ branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/manytoone/ForestType.java 2009-04-29 17:58:48 UTC (rev 16481)
@@ -23,7 +23,7 @@
private BiggestForest biggestRepresentative;
@OneToOne
- @JoinTable(name="BiggestRepresentativePerForestType",
+ @JoinTable(name="BiggestRepPerForestType",
joinColumns = @JoinColumn(name="forest_type"),
inverseJoinColumns = @JoinColumn(name="forest")
)
15 years, 7 months
Hibernate SVN: r16480 - search/trunk.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-04-29 11:31:19 -0400 (Wed, 29 Apr 2009)
New Revision: 16480
Modified:
search/trunk/pom.xml
Log:
Added a SQLServer profile.
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2009-04-29 15:30:40 UTC (rev 16479)
+++ search/trunk/pom.xml 2009-04-29 15:31:19 UTC (rev 16480)
@@ -304,7 +304,26 @@
<jdbc.isolation/>
</properties>
</profile>
+ <profile>
+ <id>sqlserver</id>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.jtds</groupId>
+ <artifactId>jtds</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
+ <jdbc.driver>net.sourceforge.jtds.jdbc.Driver</jdbc.driver>
+ <jdbc.url>jdbc:jtds:sqlserver://ec2-67-202-7-25.compute-1.amazonaws.com:1433;DatabaseName=hibernate</jdbc.url>
+ <jdbc.user>hibernate</jdbc.user>
+ <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.isolation/>
+ </properties>
+ </profile>
+
<!-- ================================ -->
<!-- Dependecy profiles to test w and -->
<!-- w/o optional dependencies -->
15 years, 7 months
Hibernate SVN: r16479 - search/trunk/src/test/java/org/hibernate/search/test.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-04-29 11:30:40 -0400 (Wed, 29 Apr 2009)
New Revision: 16479
Modified:
search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java
search/trunk/src/test/java/org/hibernate/search/test/TransactionTest.java
Log:
cleanup
Modified: search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java 2009-04-29 15:29:34 UTC (rev 16478)
+++ search/trunk/src/test/java/org/hibernate/search/test/SearchTestCase.java 2009-04-29 15:30:40 UTC (rev 16479)
@@ -11,6 +11,7 @@
import org.hibernate.HibernateException;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.Dialect;
import org.hibernate.event.PostInsertEventListener;
import org.hibernate.impl.SessionFactoryImpl;
@@ -92,7 +93,7 @@
s.close();
}
- protected void configure(org.hibernate.cfg.Configuration cfg) {
+ protected void configure(Configuration cfg) {
cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
cfg.setProperty( "hibernate.search.default.indexBase", indexDir.getAbsolutePath() );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
Modified: search/trunk/src/test/java/org/hibernate/search/test/TransactionTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/TransactionTest.java 2009-04-29 15:29:34 UTC (rev 16478)
+++ search/trunk/src/test/java/org/hibernate/search/test/TransactionTest.java 2009-04-29 15:30:40 UTC (rev 16479)
@@ -3,9 +3,11 @@
import java.io.IOException;
-import org.hibernate.Session;
import org.apache.lucene.index.IndexReader;
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+
/**
* @author Emmanuel Bernard
*/
@@ -31,19 +33,24 @@
s = getSessions().openSession();
s.getTransaction().begin();
s.persist(
- new Document( "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah" )
+ new Document(
+ "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah"
+ )
);
s.flush();
s.getTransaction().rollback();
s.close();
assertEquals( "rollback() should not index", 3, getDocumentNumber() );
-
+
s = getSessions().openSession();
+ s.connection().setAutoCommit( true ); // www.hibernate.org/403.html
s.persist(
- new Document( "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah" )
+ new Document(
+ "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah"
+ )
);
- s.flush();
+ s.flush();
s.close();
assertEquals( "no transaction should index", 4, getDocumentNumber() );
@@ -60,8 +67,7 @@
}
}
-
protected Class[] getMappings() {
- return new Class[]{Document.class};
+ return new Class[] { Document.class };
}
}
15 years, 7 months
Hibernate SVN: r16478 - search/branches/Branch_3_1/src/test/org/hibernate/search/test.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-04-29 11:29:34 -0400 (Wed, 29 Apr 2009)
New Revision: 16478
Removed:
search/branches/Branch_3_1/src/test/org/hibernate/search/test/HANTestCase.java
Modified:
search/branches/Branch_3_1/src/test/org/hibernate/search/test/SearchTestCase.java
search/branches/Branch_3_1/src/test/org/hibernate/search/test/TransactionTest.java
Log:
some cleanup
Deleted: search/branches/Branch_3_1/src/test/org/hibernate/search/test/HANTestCase.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/HANTestCase.java 2009-04-29 15:03:16 UTC (rev 16477)
+++ search/branches/Branch_3_1/src/test/org/hibernate/search/test/HANTestCase.java 2009-04-29 15:29:34 UTC (rev 16478)
@@ -1,67 +0,0 @@
-//$Id$
-package org.hibernate.search.test;
-
-import java.io.InputStream;
-
-import org.hibernate.cfg.AnnotationConfiguration;
-import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.Dialect;
-
-/**
- * Originally a copy from Hibernate Annotations.
- *
- * @author Emmanuel Bernard
- * @author Hardy Ferentschik
- */
-public abstract class HANTestCase extends TestCase {
-
- public HANTestCase() {
- super();
- }
-
- public HANTestCase(String x) {
- super( x );
- }
-
- protected void buildSessionFactory(Class[] classes, String[] packages, String[] xmlFiles) throws Exception {
- if ( getSessions() != null ) {
- getSessions().close();
- }
- try {
- setCfg( new AnnotationConfiguration() );
- configure( cfg );
- if ( recreateSchema() ) {
- cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
- }
- for ( String aPackage : packages ) {
- ( ( AnnotationConfiguration ) getCfg() ).addPackage( aPackage );
- }
- for ( Class aClass : classes ) {
- ( ( AnnotationConfiguration ) getCfg() ).addAnnotatedClass( aClass );
- }
- for ( String xmlFile : xmlFiles ) {
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFile );
- getCfg().addInputStream( is );
- }
- setDialect( Dialect.getDialect() );
- setSessions( getCfg().buildSessionFactory( /*new TestInterceptor()*/ ) );
- }
- catch ( Exception e ) {
- e.printStackTrace();
- throw e;
- }
- }
-
- protected void setUp() throws Exception {
- if ( getSessions() == null || getSessions().isClosed() || lastTestClass != getClass() ) {
- buildSessionFactory( getMappings(), getAnnotatedPackages(), getXmlFiles() );
- lastTestClass = getClass();
- }
- }
-
- protected abstract Class[] getMappings();
-
- protected String[] getAnnotatedPackages() {
- return new String[] { };
- }
-}
Modified: search/branches/Branch_3_1/src/test/org/hibernate/search/test/SearchTestCase.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/SearchTestCase.java 2009-04-29 15:03:16 UTC (rev 16477)
+++ search/branches/Branch_3_1/src/test/org/hibernate/search/test/SearchTestCase.java 2009-04-29 15:29:34 UTC (rev 16478)
@@ -2,33 +2,33 @@
package org.hibernate.search.test;
import java.io.File;
+import java.io.InputStream;
import org.apache.lucene.analysis.StopAnalyzer;
import org.apache.lucene.store.Directory;
+import org.slf4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Transaction;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.dialect.Dialect;
import org.hibernate.event.PostInsertEventListener;
import org.hibernate.impl.SessionFactoryImpl;
import org.hibernate.search.Environment;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.Search;
import org.hibernate.search.annotations.Indexed;
-import org.hibernate.search.test.inheritance.Animal;
-import org.hibernate.search.test.inheritance.Mammal;
import org.hibernate.search.event.FullTextIndexEventListener;
import org.hibernate.search.store.RAMDirectoryProvider;
-import org.hibernate.search.store.FSDirectoryProvider;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* Base class for Hibernate Search unit tests.
*
* @author Emmanuel Bernard
*/
-public abstract class SearchTestCase extends HANTestCase {
+public abstract class SearchTestCase extends TestCase {
private static final Logger log = org.hibernate.search.util.LoggerFactory.make();
@@ -49,6 +49,11 @@
ensureIndexesAreEmpty();
}
+ protected void tearDown() throws Exception {
+ SchemaExport export = new SchemaExport( cfg );
+ export.drop( false, true );
+ }
+
@SuppressWarnings("unchecked")
protected Directory getDirectory(Class clazz) {
return getLuceneEventListener().getSearchFactoryImplementor().getDirectoryProviders( clazz )[0].getDirectory();
@@ -88,7 +93,7 @@
s.close();
}
- protected void configure(org.hibernate.cfg.Configuration cfg) {
+ protected void configure(Configuration cfg) {
cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
cfg.setProperty( "hibernate.search.default.indexBase", indexDir.getAbsolutePath() );
cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
@@ -99,4 +104,39 @@
protected File getBaseIndexDir() {
return indexDir;
}
+
+ protected void buildSessionFactory(Class[] classes, String[] packages, String[] xmlFiles) throws Exception {
+ if ( getSessions() != null ) {
+ getSessions().close();
+ }
+ try {
+ setCfg( new AnnotationConfiguration() );
+ configure( cfg );
+ if ( recreateSchema() ) {
+ cfg.setProperty( org.hibernate.cfg.Environment.HBM2DDL_AUTO, "create-drop" );
+ }
+ for ( String aPackage : packages ) {
+ ( ( AnnotationConfiguration ) getCfg() ).addPackage( aPackage );
+ }
+ for ( Class aClass : classes ) {
+ ( ( AnnotationConfiguration ) getCfg() ).addAnnotatedClass( aClass );
+ }
+ for ( String xmlFile : xmlFiles ) {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFile );
+ getCfg().addInputStream( is );
+ }
+ setDialect( Dialect.getDialect() );
+ setSessions( getCfg().buildSessionFactory( /*new TestInterceptor()*/ ) );
+ }
+ catch ( Exception e ) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ protected abstract Class[] getMappings();
+
+ protected String[] getAnnotatedPackages() {
+ return new String[] { };
+ }
}
Modified: search/branches/Branch_3_1/src/test/org/hibernate/search/test/TransactionTest.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/TransactionTest.java 2009-04-29 15:03:16 UTC (rev 16477)
+++ search/branches/Branch_3_1/src/test/org/hibernate/search/test/TransactionTest.java 2009-04-29 15:29:34 UTC (rev 16478)
@@ -3,9 +3,11 @@
import java.io.IOException;
-import org.hibernate.Session;
import org.apache.lucene.index.IndexReader;
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+
/**
* @author Emmanuel Bernard
*/
@@ -31,7 +33,9 @@
s = getSessions().openSession();
s.getTransaction().begin();
s.persist(
- new Document( "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah" )
+ new Document(
+ "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah"
+ )
);
s.flush();
s.getTransaction().rollback();
@@ -40,8 +44,11 @@
assertEquals( "rollback() should not index", 3, getDocumentNumber() );
s = getSessions().openSession();
+ s.connection().setAutoCommit( true ); // www.hibernate.org/403.html
s.persist(
- new Document( "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah" )
+ new Document(
+ "Java Persistence with Hibernate", "Object/relational mapping with Hibernate", "blah blah blah"
+ )
);
s.flush();
s.close();
@@ -60,8 +67,7 @@
}
}
-
protected Class[] getMappings() {
- return new Class[]{Document.class};
+ return new Class[] { Document.class };
}
}
15 years, 7 months
Hibernate SVN: r16477 - in search/branches/Branch_3_1/src: test/org/hibernate/search/test/id and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-04-29 11:03:16 -0400 (Wed, 29 Apr 2009)
New Revision: 16477
Modified:
search/branches/Branch_3_1/src/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
search/branches/Branch_3_1/src/test/org/hibernate/search/test/id/EmbeddedIdTest.java
Log:
backported HSEARCH-306, HSEARCH-248
Modified: search/branches/Branch_3_1/src/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
===================================================================
--- search/branches/Branch_3_1/src/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2009-04-29 15:02:11 UTC (rev 16476)
+++ search/branches/Branch_3_1/src/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2009-04-29 15:03:16 UTC (rev 16477)
@@ -148,9 +148,7 @@
//if composite id, use of (a, b) in ((1,2)TwoWayString2FieldBridgeAdaptor, (3,4)) fails on most database
//a TwoWayString2FieldBridgeAdaptor is never a composite id
- safeFromTupleId = entityState != EntityState.INDEXED || TwoWayString2FieldBridgeAdaptor.class.isAssignableFrom(
- idBridge.getClass()
- );
+ safeFromTupleId = TwoWayString2FieldBridgeAdaptor.class.isAssignableFrom( idBridge.getClass() );
checkAllowFieldSelection();
if ( log.isDebugEnabled() ) {
Modified: search/branches/Branch_3_1/src/test/org/hibernate/search/test/id/EmbeddedIdTest.java
===================================================================
--- search/branches/Branch_3_1/src/test/org/hibernate/search/test/id/EmbeddedIdTest.java 2009-04-29 15:02:11 UTC (rev 16476)
+++ search/branches/Branch_3_1/src/test/org/hibernate/search/test/id/EmbeddedIdTest.java 2009-04-29 15:03:16 UTC (rev 16477)
@@ -3,48 +3,92 @@
import java.util.List;
-import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.Search;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.TermQuery;
+
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.index.Term;
+import org.hibernate.search.Search;
+import org.hibernate.search.test.SearchTestCase;
/**
* @author Emmanuel Bernard
*/
public class EmbeddedIdTest extends SearchTestCase {
public void testFieldBridge() throws Exception {
- PersonPK emmPk = new PersonPK();
- emmPk.setFirstName( "Emmanuel" );
- emmPk.setLastName( "Bernard" );
- Person emm = new Person();
- emm.setFavoriteColor( "Blue" );
- emm.setId( emmPk );
- Session s = openSession( );
+ PersonPK emmanuelPk = new PersonPK();
+ emmanuelPk.setFirstName( "Emmanuel" );
+ emmanuelPk.setLastName( "Bernard" );
+ Person emmanuel = new Person();
+ emmanuel.setFavoriteColor( "Blue" );
+ emmanuel.setId( emmanuelPk );
+
+ Session s = openSession();
Transaction tx = s.beginTransaction();
- s.save(emm);
+ s.save( emmanuel );
tx.commit();
s.clear();
+
tx = s.beginTransaction();
List results = Search.getFullTextSession( s ).createFullTextQuery(
- new TermQuery( new Term("id.lastName", "Bernard" ) ) ).list();
+ new TermQuery( new Term( "id.lastName", "Bernard" ) )
+ ).list();
assertEquals( 1, results.size() );
- emm = (Person) results.get(0);
- emm.setFavoriteColor( "Red" );
+ emmanuel = ( Person ) results.get( 0 );
+ emmanuel.setFavoriteColor( "Red" );
tx.commit();
s.clear();
+
tx = s.beginTransaction();
results = Search.getFullTextSession( s ).createFullTextQuery(
- new TermQuery( new Term("id.lastName", "Bernard" ) ) ).list();
+ new TermQuery( new Term( "id.lastName", "Bernard" ) )
+ ).list();
assertEquals( 1, results.size() );
- emm = (Person) results.get(0);
- assertEquals( "Red", emm.getFavoriteColor() );
+ emmanuel = ( Person ) results.get( 0 );
+ assertEquals( "Red", emmanuel.getFavoriteColor() );
s.delete( results.get( 0 ) );
tx.commit();
s.close();
+ }
+ /**
+ * HSEARCH-HSEARCH-306, HSEARCH-248
+ *
+ * @throws Exception throws exception in case the test fails.
+ */
+ public void testSafeFromTupleId() throws Exception {
+ PersonPK emmanuelPk = new PersonPK();
+ emmanuelPk.setFirstName( "Emmanuel" );
+ emmanuelPk.setLastName( "Bernard" );
+ Person emmanuel = new Person();
+ emmanuel.setFavoriteColor( "Blue" );
+ emmanuel.setId( emmanuelPk );
+
+ PersonPK johnPk = new PersonPK();
+ johnPk.setFirstName( "John" );
+ johnPk.setLastName( "Doe" );
+ Person john = new Person();
+ john.setFavoriteColor( "Blue" );
+ john.setId( johnPk );
+
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ s.save( emmanuel );
+ s.save( john );
+ tx.commit();
+ s.clear();
+
+ tx = s.beginTransaction();
+
+ // we need a query which has at least the size of two.
+ List results = Search.getFullTextSession( s ).createFullTextQuery(
+ new TermQuery( new Term( "favoriteColor", "blue" ) )
+ ).list();
+ assertEquals( 2, results.size() );
+ tx.commit();
+ s.close();
}
+
protected Class[] getMappings() {
return new Class[] {
Person.class
15 years, 7 months
Hibernate SVN: r16476 - in search/trunk/src: test/java/org/hibernate/search/test/id and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-04-29 11:02:11 -0400 (Wed, 29 Apr 2009)
New Revision: 16476
Modified:
search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
search/trunk/src/test/java/org/hibernate/search/test/id/EmbeddedIdTest.java
Log:
HSEARCH-306, HSEARCH-248
Added a test for composite ids. You need at least two entries in the result to get the bug to manifest itself
Modified: search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2009-04-29 14:45:14 UTC (rev 16475)
+++ search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2009-04-29 15:02:11 UTC (rev 16476)
@@ -160,7 +160,6 @@
}
}
-
protected void checkDocumentId(XProperty member, PropertiesMetadata propertiesMetadata, boolean isRoot, String prefix, InitContext context) {
Annotation idAnnotation = getIdAnnotation( member, context );
if ( idAnnotation != null ) {
Modified: search/trunk/src/test/java/org/hibernate/search/test/id/EmbeddedIdTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/id/EmbeddedIdTest.java 2009-04-29 14:45:14 UTC (rev 16475)
+++ search/trunk/src/test/java/org/hibernate/search/test/id/EmbeddedIdTest.java 2009-04-29 15:02:11 UTC (rev 16476)
@@ -3,48 +3,92 @@
import java.util.List;
-import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.Search;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.TermQuery;
+
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.index.Term;
+import org.hibernate.search.Search;
+import org.hibernate.search.test.SearchTestCase;
/**
* @author Emmanuel Bernard
*/
public class EmbeddedIdTest extends SearchTestCase {
public void testFieldBridge() throws Exception {
- PersonPK emmPk = new PersonPK();
- emmPk.setFirstName( "Emmanuel" );
- emmPk.setLastName( "Bernard" );
- Person emm = new Person();
- emm.setFavoriteColor( "Blue" );
- emm.setId( emmPk );
- Session s = openSession( );
+ PersonPK emmanuelPk = new PersonPK();
+ emmanuelPk.setFirstName( "Emmanuel" );
+ emmanuelPk.setLastName( "Bernard" );
+ Person emmanuel = new Person();
+ emmanuel.setFavoriteColor( "Blue" );
+ emmanuel.setId( emmanuelPk );
+
+ Session s = openSession();
Transaction tx = s.beginTransaction();
- s.save(emm);
+ s.save( emmanuel );
tx.commit();
s.clear();
+
tx = s.beginTransaction();
List results = Search.getFullTextSession( s ).createFullTextQuery(
- new TermQuery( new Term("id.lastName", "Bernard" ) ) ).list();
+ new TermQuery( new Term( "id.lastName", "Bernard" ) )
+ ).list();
assertEquals( 1, results.size() );
- emm = (Person) results.get(0);
- emm.setFavoriteColor( "Red" );
+ emmanuel = ( Person ) results.get( 0 );
+ emmanuel.setFavoriteColor( "Red" );
tx.commit();
s.clear();
+
tx = s.beginTransaction();
results = Search.getFullTextSession( s ).createFullTextQuery(
- new TermQuery( new Term("id.lastName", "Bernard" ) ) ).list();
+ new TermQuery( new Term( "id.lastName", "Bernard" ) )
+ ).list();
assertEquals( 1, results.size() );
- emm = (Person) results.get(0);
- assertEquals( "Red", emm.getFavoriteColor() );
+ emmanuel = ( Person ) results.get( 0 );
+ assertEquals( "Red", emmanuel.getFavoriteColor() );
s.delete( results.get( 0 ) );
tx.commit();
s.close();
+ }
+ /**
+ * HSEARCH-HSEARCH-306, HSEARCH-248
+ *
+ * @throws Exception throws exception in case the test fails.
+ */
+ public void testSafeFromTupleId() throws Exception {
+ PersonPK emmanuelPk = new PersonPK();
+ emmanuelPk.setFirstName( "Emmanuel" );
+ emmanuelPk.setLastName( "Bernard" );
+ Person emmanuel = new Person();
+ emmanuel.setFavoriteColor( "Blue" );
+ emmanuel.setId( emmanuelPk );
+
+ PersonPK johnPk = new PersonPK();
+ johnPk.setFirstName( "John" );
+ johnPk.setLastName( "Doe" );
+ Person john = new Person();
+ john.setFavoriteColor( "Blue" );
+ john.setId( johnPk );
+
+ Session s = openSession();
+ Transaction tx = s.beginTransaction();
+ s.save( emmanuel );
+ s.save( john );
+ tx.commit();
+ s.clear();
+
+ tx = s.beginTransaction();
+
+ // we need a query which has at least the size of two.
+ List results = Search.getFullTextSession( s ).createFullTextQuery(
+ new TermQuery( new Term( "favoriteColor", "blue" ) )
+ ).list();
+ assertEquals( 2, results.size() );
+ tx.commit();
+ s.close();
}
+
protected Class[] getMappings() {
return new Class[] {
Person.class
15 years, 7 months
Hibernate SVN: r16475 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-04-29 10:45:14 -0400 (Wed, 29 Apr 2009)
New Revision: 16475
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationProvidedFactoryTest.java
Log:
ANN-827 add initial support for Bean Validation
Copied: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationProvidedFactoryTest.java (from rev 16474, core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationAutoTest.java)
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationProvidedFactoryTest.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationProvidedFactoryTest.java 2009-04-29 14:45:14 UTC (rev 16475)
@@ -0,0 +1,61 @@
+package org.hibernate.test.annotations.beanvalidation;
+
+import java.math.BigDecimal;
+import java.util.Locale;
+import javax.validation.ConstraintViolationException;
+import javax.validation.MessageInterpolator;
+import javax.validation.Validation;
+import javax.validation.ValidatorFactory;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class BeanValidationProvidedFactoryTest extends TestCase {
+ public void testListeners() {
+ CupHolder ch = new CupHolder();
+ ch.setRadius( new BigDecimal( "12" ) );
+ Session s = openSession( );
+ Transaction tx = s.beginTransaction();
+ try {
+ s.persist( ch );
+ s.flush();
+ fail("invalid object should not be persisted");
+ }
+ catch ( ConstraintViolationException e ) {
+ assertEquals( 1, e.getConstraintViolations().size() );
+ assertEquals( "Oops", e.getConstraintViolations().iterator().next().getMessage() );
+ }
+ tx.rollback();
+ s.close();
+ }
+
+ protected Class<?>[] getMappings() {
+ return new Class<?>[] {
+ CupHolder.class
+ };
+ }
+
+ @Override
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ final MessageInterpolator messageInterpolator = new MessageInterpolator() {
+
+ public String interpolate(String s, Context context) {
+ return "Oops";
+ }
+
+ public String interpolate(String s, Context context, Locale locale) {
+ return interpolate( s, context );
+ }
+ };
+ final javax.validation.Configuration<?> configuration = Validation.byDefaultProvider().configure();
+ configuration.messageInterpolator( messageInterpolator );
+ ValidatorFactory vf = configuration.buildValidatorFactory();
+ cfg.getProperties().put( "javax.persistence.validation.factory", vf);
+ }
+}
\ No newline at end of file
15 years, 7 months
Hibernate SVN: r16474 - in core/trunk/annotations: src/main/java/org/hibernate/cfg and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-04-29 08:25:30 -0400 (Wed, 29 Apr 2009)
New Revision: 16474
Added:
core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/
core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationActivator.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationAutoTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationDisabledTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationGroupsTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/CupHolder.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Strict.java
Modified:
core/trunk/annotations/pom.xml
core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java
Log:
ANN-827 add initial support for Bean Validation
Modified: core/trunk/annotations/pom.xml
===================================================================
--- core/trunk/annotations/pom.xml 2009-04-29 08:32:41 UTC (rev 16473)
+++ core/trunk/annotations/pom.xml 2009-04-29 12:25:30 UTC (rev 16474)
@@ -71,7 +71,16 @@
<artifactId>cglib</artifactId>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<dependencyManagement>
@@ -97,10 +106,20 @@
<version>3.4.GA</version>
</dependency>
<dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- <version>2.2</version>
- </dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.Beta1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.CR2</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java 2009-04-29 08:32:41 UTC (rev 16473)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -69,6 +69,7 @@
import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
import org.hibernate.cfg.annotations.Version;
import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
+import org.hibernate.cfg.beanvalidation.BeanValidationActivator;
import org.hibernate.engine.NamedQueryDefinition;
import org.hibernate.engine.NamedSQLQueryDefinition;
import org.hibernate.engine.ResultSetMappingDefinition;
@@ -800,6 +801,13 @@
}
public SessionFactory buildSessionFactory() throws HibernateException {
+ enableLegacyHibernateValidator();
+ enableBeanValidation();
+ enableHibernateSearch();
+ return super.buildSessionFactory();
+ }
+
+ private void enableLegacyHibernateValidator() {
//add validator events if the jar is available
boolean enableValidatorListeners = !"false".equalsIgnoreCase( getProperty( "hibernate.validator.autoregister_listeners" ) );
Class validateEventListenerClass = null;
@@ -868,12 +876,12 @@
}
}
}
-
- enableHibernateSearch();
-
- return super.buildSessionFactory();
}
+ private void enableBeanValidation() {
+ BeanValidationActivator.activateBeanValidation( getEventListeners(), getProperties() );
+ }
+
/**
* Tries to automatically register Hibernate Search event listeners by locating the
* appropriate bootstrap class and calling the <code>enableHibernateSearch</code> method.
Added: core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationActivator.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationActivator.java (rev 0)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationActivator.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,87 @@
+package org.hibernate.cfg.beanvalidation;
+
+import java.util.Map;
+import java.util.Properties;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.hibernate.util.ReflectHelper;
+import org.hibernate.HibernateException;
+import org.hibernate.AssertionFailure;
+import org.hibernate.event.EventListeners;
+
+/**
+ * This class has no hard depenmdency on Bean Validation APIs
+ * It must uses reflectione very time BV is required.
+ * @author Emmanuel Bernard
+ */
+public class BeanValidationActivator {
+
+ private static final String BV_DISCOVERY_CLASS = "javax.validation.Validation";
+ private static final String TYPE_SAFE_ACTIVATOR_CLASS = "org.hibernate.cfg.beanvalidation.TypeSafeActivator";
+ private static final String TYPE_SAFE_ACTIVATOR_METHOD = "activateBeanValidation";
+ private static final String MODE_PROPERTY = "javax.persistence.validation.mode";
+
+ public static void activateBeanValidation(EventListeners eventListeners, Properties properties) {
+ ValidationMode mode = ValidationMode.getMode( properties.get( MODE_PROPERTY ) );
+ if (mode == ValidationMode.NONE) return;
+ try {
+ //load Validation
+ ReflectHelper.classForName( BV_DISCOVERY_CLASS, BeanValidationActivator.class );
+ }
+ catch ( ClassNotFoundException e ) {
+
+ if (mode == ValidationMode.CALLBACK) {
+ throw new HibernateException( "Bean Validation not available in the class path but required in " + MODE_PROPERTY );
+ }
+ else if (mode == ValidationMode.AUTO) {
+ //nothing to activate
+ return;
+ }
+ else {
+ throw new AssertionFailure( "Unexpected ValidationMode: " + mode );
+ }
+ }
+ try {
+ Class<?> activator = ReflectHelper.classForName( TYPE_SAFE_ACTIVATOR_CLASS, BeanValidationActivator.class );
+ Method buildDefaultValidatorFactory =
+ activator.getMethod( TYPE_SAFE_ACTIVATOR_METHOD, EventListeners.class, Properties.class );
+ buildDefaultValidatorFactory.invoke( null, eventListeners, properties );
+ }
+ catch ( NoSuchMethodException e ) {
+ throw new HibernateException( "Unable to get the default Bean Validation factory", e);
+ }
+ catch ( IllegalAccessException e ) {
+ throw new HibernateException( "Unable to get the default Bean Validation factory", e);
+ }
+ catch ( InvocationTargetException e ) {
+ throw new HibernateException( "Unable to get the default Bean Validation factory", e);
+ }
+ catch ( ClassNotFoundException e ) {
+ throw new HibernateException( "Unable to get the default Bean Validation factory", e);
+ }
+ }
+
+ private static enum ValidationMode {
+ AUTO,
+ CALLBACK,
+ NONE;
+
+ public static ValidationMode getMode(Object modeProperty) {
+ if (modeProperty == null) {
+ return AUTO;
+ }
+ else {
+ try {
+ return valueOf( modeProperty.toString().toUpperCase() );
+ }
+ catch ( IllegalArgumentException e ) {
+ throw new HibernateException( "Unknown validation mode in " + MODE_PROPERTY + ": " + modeProperty.toString() );
+ }
+ }
+ }
+ }
+}
Added: core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java (rev 0)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/BeanValidationEventListener.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,156 @@
+package org.hibernate.cfg.beanvalidation;
+
+import java.util.Set;
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import javax.validation.ValidatorFactory;
+import javax.validation.ConstraintViolation;
+import javax.validation.TraversableResolver;
+import javax.validation.Validator;
+import javax.validation.ConstraintViolationException;
+import javax.validation.groups.Default;
+
+import org.hibernate.event.PreInsertEventListener;
+import org.hibernate.event.PreUpdateEventListener;
+import org.hibernate.event.PreDeleteEventListener;
+import org.hibernate.event.PreInsertEvent;
+import org.hibernate.event.PreUpdateEvent;
+import org.hibernate.event.PreDeleteEvent;
+import org.hibernate.EntityMode;
+import org.hibernate.HibernateException;
+import org.hibernate.util.ReflectHelper;
+
+/**
+ * @author Emmanuel Bernard
+ */
+//FIXME review exception model
+public class BeanValidationEventListener implements
+ PreInsertEventListener, PreUpdateEventListener, PreDeleteEventListener {
+ private static final String JPA_GROUP_PREFIX = "javax.persistence.validation.group.";
+ private static final Class<?>[] DEFAULT_GROUPS = new Class<?>[] { Default.class };
+ private static final Class<?>[] EMPTY_GROUPS = new Class<?>[] { };
+
+ private ValidatorFactory factory;
+ private TraversableResolver tr;
+ private Map<Operation, Class<?>[]> groupsPerOperation = new HashMap<Operation, Class<?>[]>(3);
+
+
+ public BeanValidationEventListener(ValidatorFactory factory, Properties properties) {
+ this.factory = factory;
+ setGroupsForOperation( Operation.INSERT, properties );
+ setGroupsForOperation( Operation.UPDATE, properties );
+ setGroupsForOperation( Operation.DELETE, properties );
+ }
+
+ private void setGroupsForOperation(Operation operation, Properties properties) {
+ Object property = properties.get( JPA_GROUP_PREFIX + operation.getGroupPropertyName() );
+
+ Class<?>[] groups;
+ if ( property == null ) {
+ groups = operation == Operation.DELETE ? EMPTY_GROUPS : DEFAULT_GROUPS;
+ }
+ else {
+ if ( property instanceof String ) {
+ String stringProperty = (String) property;
+ String[] groupNames = stringProperty.split( "," );
+ if ( groupNames.length == 1 && groupNames[0].equals( "" ) ) {
+ groups = EMPTY_GROUPS;
+ }
+ else {
+ List<Class<?>> groupsList = new ArrayList<Class<?>>(groupNames.length);
+ for (String groupName : groupNames) {
+ String cleanedGroupName = groupName.trim();
+ if ( cleanedGroupName.length() > 0) {
+ try {
+ groupsList.add( ReflectHelper.classForName( cleanedGroupName ) );
+ }
+ catch ( ClassNotFoundException e ) {
+ throw new HibernateException( "Unable to load class " + cleanedGroupName, e );
+ }
+ }
+
+ }
+ groups = groupsList.toArray( new Class<?>[groupsList.size()] );
+ }
+ }
+ else if ( property instanceof Class<?>[] ) {
+ groups = (Class<?>[]) property;
+ }
+ else {
+ //null is bad and excluded by instanceof => exception is raised
+ throw new HibernateException( JPA_GROUP_PREFIX + operation.getGroupPropertyName() + " is of unknown type: String or Class<?>[] only");
+ }
+ }
+ groupsPerOperation.put( operation, groups );
+ }
+
+ public boolean onPreInsert(PreInsertEvent event) {
+ validate( event.getEntity(), event.getSession().getEntityMode(), Operation.INSERT );
+ return false;
+ }
+
+ public boolean onPreUpdate(PreUpdateEvent event) {
+ validate( event.getEntity(), event.getSession().getEntityMode(), Operation.UPDATE );
+ return false;
+ }
+
+ public boolean onPreDelete(PreDeleteEvent event) {
+ validate( event.getEntity(), event.getSession().getEntityMode(), Operation.DELETE );
+ return false;
+ }
+
+ private <T> void validate(T object, EntityMode mode, Operation operation) {
+ if ( object == null || mode != EntityMode.POJO ) return;
+ Validator validator = factory.usingContext()
+ //.traversableResolver( tr )
+ .getValidator();
+ final Class<?>[] groups = groupsPerOperation.get( operation );
+ if ( groups.length > 0 ) {
+ final Set<ConstraintViolation<T>> constraintViolations =
+ validator.validate( object, groups );
+ //FIXME CV should no longer be generics
+ Object unsafeViolations = constraintViolations;
+ if (constraintViolations.size() > 0 ) {
+ //FIXME add Set<ConstraintViolation<?>>
+ throw new ConstraintViolationException(
+ "Invalid object at " + operation.getName() + " time for groups " + toString( groups ),
+ (Set<ConstraintViolation>) unsafeViolations);
+ }
+ }
+ }
+
+ private String toString(Class<?>[] groups) {
+ StringBuilder toString = new StringBuilder( "[");
+ for ( Class<?> group : groups ) {
+ toString.append( group.getName() ).append( ", " );
+ }
+ toString.append( "]" );
+ return toString.toString();
+ }
+
+ private static enum Operation {
+ INSERT("persist", "pre-persist"),
+ UPDATE("update", "pre-update"),
+ DELETE("remove", "pre-remove");
+
+ private String exposedName;
+ private String groupPropertyName;
+
+ Operation(String exposedName, String groupProperty) {
+ this.exposedName = exposedName;
+ this.groupPropertyName = groupProperty;
+ }
+
+ public String getName() {
+ return exposedName;
+ }
+
+ public String getGroupPropertyName() {
+ return groupPropertyName;
+ }
+ }
+
+}
Added: core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java (rev 0)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,79 @@
+package org.hibernate.cfg.beanvalidation;
+
+import java.util.Map;
+import java.util.Arrays;
+import java.util.Properties;
+import javax.validation.ValidatorFactory;
+import javax.validation.Validation;
+
+import org.hibernate.HibernateException;
+import org.hibernate.event.EventListeners;
+import org.hibernate.event.PreInsertEventListener;
+import org.hibernate.event.PreUpdateEventListener;
+import org.hibernate.event.PreDeleteEventListener;
+
+/**
+ * @author Emmanuel Bernard
+ */
+class TypeSafeActivator {
+
+ private static final String FACTORY_PROPERTY = "javax.persistence.validation.factory";
+
+ public static void activateBeanValidation(EventListeners eventListeners, Properties properties) {
+ ValidatorFactory factory = getValidatorFactory( properties );
+ BeanValidationEventListener beanValidationEventListener = new BeanValidationEventListener( factory, properties );
+
+ {
+ PreInsertEventListener[] listeners = eventListeners.getPreInsertEventListeners();
+ int length = listeners.length + 1;
+ PreInsertEventListener[] newListeners = new PreInsertEventListener[length];
+ System.arraycopy( listeners, 0, newListeners, 0, length - 1 );
+ newListeners[length - 1] = beanValidationEventListener;
+ eventListeners.setPreInsertEventListeners( newListeners );
+ }
+
+ {
+ PreUpdateEventListener[] listeners = eventListeners.getPreUpdateEventListeners();
+ int length = listeners.length + 1;
+ PreUpdateEventListener[] newListeners = new PreUpdateEventListener[length];
+ System.arraycopy( listeners, 0, newListeners, 0, length - 1 );
+ newListeners[length - 1] = beanValidationEventListener;
+ eventListeners.setPreUpdateEventListeners( newListeners );
+ }
+
+ {
+ PreDeleteEventListener[] listeners = eventListeners.getPreDeleteEventListeners();
+ int length = listeners.length + 1;
+ PreDeleteEventListener[] newListeners = new PreDeleteEventListener[length];
+ System.arraycopy( listeners, 0, newListeners, 0, length - 1 );
+ newListeners[length - 1] = beanValidationEventListener;
+ eventListeners.setPreDeleteEventListeners( newListeners );
+ }
+ }
+
+ static ValidatorFactory getValidatorFactory(Map<Object, Object> properties) {
+ ValidatorFactory factory = null;
+ if ( properties != null ) {
+ Object unsafeProperty = properties.get( FACTORY_PROPERTY );
+ if (unsafeProperty != null) {
+ try {
+ factory = ValidatorFactory.class.cast( unsafeProperty );
+ }
+ catch ( ClassCastException e ) {
+ throw new HibernateException( "Property " + FACTORY_PROPERTY
+ + " should containt an object of type " + ValidatorFactory.class.getName() );
+ }
+ }
+ }
+ if (factory == null) {
+ try {
+ factory = Validation.buildDefaultValidatorFactory();
+ }
+ catch ( Exception e ) {
+ throw new HibernateException( "Unable to build the default ValidatorFactory", e);
+ }
+ }
+ return factory;
+ }
+
+}
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationAutoTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationAutoTest.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationAutoTest.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,36 @@
+package org.hibernate.test.annotations.beanvalidation;
+
+import java.math.BigDecimal;
+import javax.validation.ConstraintViolationException;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class BeanValidationAutoTest extends TestCase {
+ public void testListeners() {
+ CupHolder ch = new CupHolder();
+ ch.setRadius( new BigDecimal( "12" ) );
+ Session s = openSession( );
+ Transaction tx = s.beginTransaction();
+ try {
+ s.persist( ch );
+ s.flush();
+ fail("invalid object should not be persisted");
+ }
+ catch ( ConstraintViolationException e ) {
+ assertEquals( 1, e.getConstraintViolations().size() );
+ }
+ tx.rollback();
+ s.close();
+ }
+
+ protected Class<?>[] getMappings() {
+ return new Class<?>[] {
+ CupHolder.class
+ };
+ }
+}
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationDisabledTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationDisabledTest.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationDisabledTest.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,42 @@
+package org.hibernate.test.annotations.beanvalidation;
+
+import java.math.BigDecimal;
+import javax.validation.ConstraintViolationException;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class BeanValidationDisabledTest extends TestCase {
+ public void testListeners() {
+ CupHolder ch = new CupHolder();
+ ch.setRadius( new BigDecimal( "12" ) );
+ Session s = openSession( );
+ Transaction tx = s.beginTransaction();
+ try {
+ s.persist( ch );
+ s.flush();
+ }
+ catch ( ConstraintViolationException e ) {
+ fail("invalid object should not be validated");
+ }
+ tx.rollback();
+ s.close();
+ }
+
+ @Override
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( "javax.persistence.validation.mode", "none" );
+ }
+
+ protected Class<?>[] getMappings() {
+ return new Class<?>[] {
+ CupHolder.class
+ };
+ }
+}
\ No newline at end of file
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationGroupsTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationGroupsTest.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/BeanValidationGroupsTest.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,68 @@
+package org.hibernate.test.annotations.beanvalidation;
+
+import java.math.BigDecimal;
+import javax.validation.ConstraintViolationException;
+import javax.validation.constraints.NotNull;
+import javax.validation.groups.Default;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.annotations.reflection.XMLContext;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class BeanValidationGroupsTest extends TestCase {
+ public void testListeners() {
+ CupHolder ch = new CupHolder();
+ ch.setRadius( new BigDecimal( "12" ) );
+ Session s = openSession( );
+ Transaction tx = s.beginTransaction();
+ try {
+ s.persist( ch );
+ s.flush();
+ }
+ catch ( ConstraintViolationException e ) {
+ fail("invalid object should not be validated");
+ }
+ try {
+ ch.setRadius( null );
+ s.flush();
+ }
+ catch ( ConstraintViolationException e ) {
+ fail("invalid object should not be validated");
+ }
+ try {
+ s.delete( ch );
+ s.flush();
+ fail("invalid object should not be persisted");
+ }
+ catch ( ConstraintViolationException e ) {
+ assertEquals( 1, e.getConstraintViolations().size() );
+ assertEquals( NotNull.class,
+ e.getConstraintViolations().iterator().next().getConstraintDescriptor().getAnnotation().annotationType()
+ );
+ }
+ tx.rollback();
+ s.close();
+ }
+
+ @Override
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( "javax.persistence.validation.group.pre-persist",
+ "" );
+ cfg.setProperty( "javax.persistence.validation.group.pre-update",
+ "" );
+ cfg.setProperty( "javax.persistence.validation.group.pre-remove",
+ Default.class.getName() + ", " + Strict.class.getName() );
+ }
+
+ protected Class<?>[] getMappings() {
+ return new Class<?>[] {
+ CupHolder.class
+ };
+ }
+}
\ No newline at end of file
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/CupHolder.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/CupHolder.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/CupHolder.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,37 @@
+package org.hibernate.test.annotations.beanvalidation;
+
+import java.math.BigDecimal;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class CupHolder {
+ @Id
+ @GeneratedValue
+ private Integer id;
+ private BigDecimal radius;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ @Max( value = 10, message = "Radius way out")
+ @NotNull(groups = Strict.class)
+ public BigDecimal getRadius() {
+ return radius;
+ }
+
+ public void setRadius(BigDecimal radius) {
+ this.radius = radius;
+ }
+}
Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Strict.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Strict.java (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/beanvalidation/Strict.java 2009-04-29 12:25:30 UTC (rev 16474)
@@ -0,0 +1,7 @@
+package org.hibernate.test.annotations.beanvalidation;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public interface Strict {
+}
15 years, 7 months
Hibernate SVN: r16473 - in core/branches/Branch_3_3: tutorials and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-04-29 04:32:41 -0400 (Wed, 29 Apr 2009)
New Revision: 16473
Modified:
core/branches/Branch_3_3/testsuite/pom.xml
core/branches/Branch_3_3/tutorials/pom.xml
Log:
HHH-3886 - Updated the credentials for QA Lab for Branch_3_3 (just core)
Modified: core/branches/Branch_3_3/testsuite/pom.xml
===================================================================
--- core/branches/Branch_3_3/testsuite/pom.xml 2009-04-29 08:18:36 UTC (rev 16472)
+++ core/branches/Branch_3_3/testsuite/pom.xml 2009-04-29 08:32:41 UTC (rev 16473)
@@ -162,9 +162,9 @@
<properties>
<db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
- <jdbc.url>jdbc:mysql://dev02.qa.atl.jboss.com/platformae</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.url>jdbc:mysql://dev02.qa.atl.jboss.com/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -183,9 +183,9 @@
<properties>
<db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
<jdbc.driver>org.postgresql.Driver</jdbc.driver>
- <jdbc.url>jdbc:postgresql://dev01.qa.atl.jboss.com:5432:platformae</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.url>jdbc:postgresql://dev01.qa.atl.jboss.com:5432:hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -214,9 +214,9 @@
<properties>
<db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
- <jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
- <jdbc.user>pltfrmae</jdbc.user>
- <jdbc.pass>pltfrmae</jdbc.pass>
+ <jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -239,9 +239,9 @@
<properties>
<db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
- <jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
- <jdbc.user>pltfrmae</jdbc.user>
- <jdbc.pass>pltfrmae</jdbc.pass>
+ <jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -261,8 +261,8 @@
<db.dialect>org.hibernate.dialect.Oracle9iDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
<jdbc.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -282,8 +282,8 @@
<db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
<jdbc.url>jdbc:oracle:thin:@dev01.qa.atl.jboss.com:1521:qadb01</jdbc.url>
- <jdbc.user>hibernate</jdbc.user>
- <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -301,9 +301,9 @@
<properties>
<db.dialect>org.hibernate.dialect.SybaseASE15Dialect</db.dialect>
<jdbc.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.driver>
- <jdbc.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/platformae</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -322,8 +322,8 @@
<db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
<jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
<jdbc.url>jdbc:sqlserver://dev30.qa.atl.jboss.com:3918</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation>4096</jdbc.isolation>
</properties>
</profile>
Modified: core/branches/Branch_3_3/tutorials/pom.xml
===================================================================
--- core/branches/Branch_3_3/tutorials/pom.xml 2009-04-29 08:18:36 UTC (rev 16472)
+++ core/branches/Branch_3_3/tutorials/pom.xml 2009-04-29 08:32:41 UTC (rev 16473)
@@ -206,9 +206,9 @@
<properties>
<db.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</db.dialect>
<jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
- <jdbc.url>jdbc:mysql://dev02.qa.atl.jboss.com/platformae</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.url>jdbc:mysql://dev02.qa.atl.jboss.com/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -227,9 +227,9 @@
<properties>
<db.dialect>org.hibernate.dialect.PostgreSQLDialect</db.dialect>
<jdbc.driver>org.postgresql.Driver</jdbc.driver>
- <jdbc.url>jdbc:postgresql://dev01.qa.atl.jboss.com:5432:platformae</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.url>jdbc:postgresql://dev01.qa.atl.jboss.com:5432:hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -258,9 +258,9 @@
<properties>
<db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
- <jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
- <jdbc.user>pltfrmae</jdbc.user>
- <jdbc.pass>pltfrmae</jdbc.pass>
+ <jdbc.url>jdbc:db2://dev32.qa.atl.jboss.com:50000/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -283,9 +283,9 @@
<properties>
<db.dialect>org.hibernate.dialect.DB2Dialect</db.dialect>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
- <jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/jbossqa</jdbc.url>
- <jdbc.user>pltfrmae</jdbc.user>
- <jdbc.pass>pltfrmae</jdbc.pass>
+ <jdbc.url>jdbc:db2://dev67.qa.atl.jboss.com:50000/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -305,8 +305,8 @@
<db.dialect>org.hibernate.dialect.Oracle9iDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
<jdbc.url>jdbc:oracle:thin:@dev20.qa.atl.jboss.com:1521:qa</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -326,8 +326,8 @@
<db.dialect>org.hibernate.dialect.Oracle10gDialect</db.dialect>
<jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
<jdbc.url>jdbc:oracle:thin:@dev01.qa.atl.jboss.com:1521:qadb01</jdbc.url>
- <jdbc.user>hibernate</jdbc.user>
- <jdbc.pass>hibernate</jdbc.pass>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -345,9 +345,9 @@
<properties>
<db.dialect>org.hibernate.dialect.SybaseASE15Dialect</db.dialect>
<jdbc.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.driver>
- <jdbc.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/platformae</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.url>jdbc:sybase:Tds:dev77.qa.atl2.redhat.com:5000/hibbr330</jdbc.url>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation />
</properties>
</profile>
@@ -366,8 +366,8 @@
<db.dialect>org.hibernate.dialect.SQLServerDialect</db.dialect>
<jdbc.driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc.driver>
<jdbc.url>jdbc:sqlserver://dev30.qa.atl.jboss.com:3918</jdbc.url>
- <jdbc.user>platformae</jdbc.user>
- <jdbc.pass>platformae</jdbc.pass>
+ <jdbc.user>hibbr330</jdbc.user>
+ <jdbc.pass>hibbr330</jdbc.pass>
<jdbc.isolation>4096</jdbc.isolation>
</properties>
</profile>
15 years, 7 months