Hibernate SVN: r10468 - branches/Branch_3_2/Hibernate3/src/org/hibernate
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2006-09-08 08:23:08 -0400 (Fri, 08 Sep 2006)
New Revision: 10468
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/FlushMode.java
Log:
HHH-2042 : FlushMode javadoc
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/FlushMode.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/FlushMode.java 2006-09-06 23:07:54 UTC (rev 10467)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/FlushMode.java 2006-09-08 12:23:08 UTC (rev 10468)
@@ -11,6 +11,9 @@
* and executing SQL statements.
*
* @see Session#setFlushMode(FlushMode)
+ * @see Query#setFlushMode(FlushMode)
+ * @see Criteria#setFlushMode(FlushMode)
+ *
* @author Gavin King
*/
public final class FlushMode implements Serializable {
@@ -23,12 +26,13 @@
this.level = level;
this.name = name;
}
+
public String toString() {
return name;
}
/**
- * The <tt>Session</tt> is never flushed unless <tt>flush()</tt>
+ * The {@link Session} is never flushed unless {@link Session#flush}
* is explicitly called by the application. This mode is very
* efficient for read only transactions.
*
@@ -37,27 +41,27 @@
public static final FlushMode NEVER = new FlushMode( 0, "NEVER" );
/**
- * The <tt>Session</tt> is onyl eve flushed when <tt>flush()</tt>
+ * The {@link Session} is only ever flushed when {@link Session#flush}
* is explicitly called by the application. This mode is very
* efficient for read only transactions.
*/
public static final FlushMode MANUAL = new FlushMode( 0, "MANUAL" );
/**
- * The <tt>Session</tt> is flushed when <tt>Transaction.commit()</tt>
+ * The {@link Session} is flushed when {@link Transaction#commit}
* is called.
*/
public static final FlushMode COMMIT = new FlushMode(5, "COMMIT");
/**
- * The <tt>Session</tt> is sometimes flushed before query execution
+ * The {@link Session} is sometimes flushed before query execution
* in order to ensure that queries never return stale state. This
* is the default flush mode.
*/
public static final FlushMode AUTO = new FlushMode(10, "AUTO");
/**
- * The <tt>Session</tt> is flushed before every query. This is
+ * The {@link Session} is flushed before every query. This is
* almost always unnecessary and inefficient.
*/
public static final FlushMode ALWAYS = new FlushMode(20, "ALWAYS");
@@ -86,9 +90,3 @@
return ( FlushMode ) INSTANCES.get( name );
}
}
-
-
-
-
-
-
18 years, 4 months
Hibernate SVN: r10467 - tags/annotations_v3_2_0_CR2_TEMP
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 19:07:54 -0400 (Wed, 06 Sep 2006)
New Revision: 10467
Added:
tags/annotations_v3_2_0_CR2_TEMP/HibernateExt/
Log:
release
Copied: tags/annotations_v3_2_0_CR2_TEMP/HibernateExt (from rev 10466, trunk/HibernateExt)
18 years, 4 months
Hibernate SVN: r10466 - tags
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 19:07:09 -0400 (Wed, 06 Sep 2006)
New Revision: 10466
Added:
tags/annotations_v3_2_0_CR2_TEMP/
Log:
Created folder remotely
18 years, 4 months
Hibernate SVN: r10465 - in trunk/HibernateExt: ejb ejb/lib metadata metadata/lib
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 18:03:08 -0400 (Wed, 06 Sep 2006)
New Revision: 10465
Modified:
trunk/HibernateExt/ejb/build.xml
trunk/HibernateExt/ejb/lib/README.txt
trunk/HibernateExt/ejb/lib/ejb3-persistence.jar
trunk/HibernateExt/ejb/lib/hibernate-annotations.jar
trunk/HibernateExt/ejb/lib/javassist.jar
trunk/HibernateExt/ejb/readme.txt
trunk/HibernateExt/metadata/build.xml
trunk/HibernateExt/metadata/lib/ejb3-persistence.jar
trunk/HibernateExt/metadata/readme.txt
Log:
release
Modified: trunk/HibernateExt/ejb/build.xml
===================================================================
--- trunk/HibernateExt/ejb/build.xml 2006-09-06 18:43:47 UTC (rev 10464)
+++ trunk/HibernateExt/ejb/build.xml 2006-09-06 22:03:08 UTC (rev 10465)
@@ -16,7 +16,7 @@
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="Hibernate EntityManager"/>
<property name="name" value="hibernate-entitymanager"/>
- <property name="version" value="3.2.0.CR1"/>
+ <property name="version" value="3.2.0.CR2"/>
<property name="javadoc.packagenames" value="org.hibernate.ejb.*"/>
<property name="jdbc.dir" value="jdbc"/>
<property name="copy.test" value="true"/>
Modified: trunk/HibernateExt/ejb/lib/README.txt
===================================================================
--- trunk/HibernateExt/ejb/lib/README.txt 2006-09-06 18:43:47 UTC (rev 10464)
+++ trunk/HibernateExt/ejb/lib/README.txt 2006-09-06 22:03:08 UTC (rev 10465)
@@ -1,7 +1,7 @@
Hibernate Metadata dependencies
===============================
-ejb3-persistence (proposed final draft): required
-hibernate-annotations (3.1beta9): required
-javassist (3.1): required
-jboss-archive-browsing (5.0.0alpha build: CVSTag=HEAD date=200507071617): required
+ejb3-persistence (final release): required
+hibernate-annotations: required
+javassist (3.3): required
+jboss-archive-browsing (5.0.0alpha build: CVSTag=HEAD date=200607201 119): required
Modified: trunk/HibernateExt/ejb/lib/ejb3-persistence.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/ejb/lib/hibernate-annotations.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/ejb/lib/javassist.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/ejb/readme.txt
===================================================================
--- trunk/HibernateExt/ejb/readme.txt 2006-09-06 18:43:47 UTC (rev 10464)
+++ trunk/HibernateExt/ejb/readme.txt 2006-09-06 22:03:08 UTC (rev 10465)
@@ -1,9 +1,9 @@
Hibernate EntityManager
==================================================
-Version: 3.2.0.CR1, 13.05.2006
+Version: 3.2.0.CR2, xx.09.2006
-THIS RELEASE OF HIBERNATE ENTITYMANAGER REQUIRES HIBERNATE 3.2.0.CR2 AND DOES
-NOT WORK WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE.
+THIS RELEASE OF HIBERNATE ENTITYMANAGER REQUIRES HIBERNATE CORE 3.2.0.CR4 AND
+DOES NOT WORK WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE.
Description
Modified: trunk/HibernateExt/metadata/build.xml
===================================================================
--- trunk/HibernateExt/metadata/build.xml 2006-09-06 18:43:47 UTC (rev 10464)
+++ trunk/HibernateExt/metadata/build.xml 2006-09-06 22:03:08 UTC (rev 10465)
@@ -16,7 +16,7 @@
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="Hibernate Annotations"/>
<property name="name" value="hibernate-annotations"/>
- <property name="version" value="3.2.0.CR1"/>
+ <property name="version" value="3.2.0.CR2"/>
<property name="javadoc.packagenames" value="org.hibernate.*"/>
<property name="jdbc.dir" value="jdbc"/>
<property name="copy.test" value="true"/>
Modified: trunk/HibernateExt/metadata/lib/ejb3-persistence.jar
===================================================================
(Binary files differ)
Modified: trunk/HibernateExt/metadata/readme.txt
===================================================================
--- trunk/HibernateExt/metadata/readme.txt 2006-09-06 18:43:47 UTC (rev 10464)
+++ trunk/HibernateExt/metadata/readme.txt 2006-09-06 22:03:08 UTC (rev 10465)
@@ -1,9 +1,9 @@
Hibernate Annotations
==================================================
-Version: 3.2.0 CR1, 13.05.2006
+Version: 3.2.0 CR2, xx.09.2006
-THIS RELEASE OF HIBERNATE ANNOTATIONS REQUIRES HIBERNATE 3.2.0.CR2 AND DOES NOT WORK
-WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE.
+THIS RELEASE OF HIBERNATE ANNOTATIONS REQUIRES HIBERNATE CORE 3.2.0.CR4 AND DOES NOT
+WORK WITH HIBERNATE 3.1.x OR ANY OLDER VERSION OF HIBERNATE.
Description
18 years, 4 months
Hibernate SVN: r10464 - trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 14:43:47 -0400 (Wed, 06 Sep 2006)
New Revision: 10464
Added:
trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/MappingTest.java
trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/TestCase.java
Removed:
trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java
Log:
lucene test
Deleted: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java
===================================================================
--- trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java 2006-09-06 18:42:50 UTC (rev 10463)
+++ trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java 2006-09-06 18:43:47 UTC (rev 10464)
@@ -1,191 +0,0 @@
-//$Id$
-package org.hibernate.lucene.test;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.lucene.analysis.StopAnalyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.TermDocs;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Hits;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Query;
-import org.hibernate.Session;
-import org.hibernate.event.PostDeleteEventListener;
-import org.hibernate.event.PostInsertEventListener;
-import org.hibernate.event.PostUpdateEventListener;
-import org.hibernate.lucene.Environment;
-import org.hibernate.lucene.event.LuceneEventListener;
-import org.hibernate.test.HATest;
-import static org.testng.AssertJUnit.*;
-import org.testng.annotations.Configuration;
-import org.testng.annotations.Test;
-
-/**
- * @author Gavin King
- */
-@Test(groups="lucene")
-public class LuceneTest extends HATest {
-
-
- @Configuration(beforeTestClass = true)
- protected void setUpIndex() throws Exception {
- File sub = getBaseIndexDir();
- sub.mkdir();
- super.setUp();
- }
-
- private File getBaseIndexDir() {
- File current = new File( "." );
- File sub = new File( current, "indextemp" );
- return sub;
- }
-
- @Configuration(afterTestClass = true)
- protected void tearDownIndex() throws Exception {
- File sub = getBaseIndexDir();
- delete( sub );
- }
-
- private void delete(File sub) {
- if ( sub.isDirectory() ) {
- for ( File file : sub.listFiles() ) {
- delete( file );
- }
- sub.delete();
- }
- else {
- sub.delete();
- }
- }
-
- @Test
- public void testEventIntegration() throws Exception {
-
-
- Session s = getSessions().openSession();
- s.getTransaction().begin();
- s.persist(
- new Document( "Hibernate in Action", "Object/relational mapping with Hibernate", "blah blah blah" )
- );
- s.getTransaction().commit();
- s.close();
- IndexReader reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
- try {
- int num = reader.numDocs();
- assertEquals( 1, num );
- TermDocs docs = reader.termDocs( new Term( "Abstract", "Hibernate" ) );
- org.apache.lucene.document.Document doc = reader.document( docs.doc() );
- assertFalse( docs.next() );
- docs = reader.termDocs( new Term( "Title", "Action" ) );
- doc = reader.document( docs.doc() );
- assertFalse( docs.next() );
- assertEquals( "1", doc.getField( "id" ).stringValue() );
- }
- finally {
- reader.close();
- }
-
- s = getSessions().openSession();
- s.getTransaction().begin();
- Document entity = (Document) s.get( Document.class, new Long( 1 ) );
- entity.setSummary( "Object/relational mapping with EJB3" );
- s.persist( new Document( "Seam in Action", "", "blah blah blah blah" ) );
- s.getTransaction().commit();
- s.close();
-
- reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
- try {
- int num = reader.numDocs();
- assertEquals( 2, num );
- TermDocs docs = reader.termDocs( new Term( "Abstract", "EJB3" ) );
- org.apache.lucene.document.Document doc = reader.document( docs.doc() );
- assertFalse( docs.next() );
- }
- finally {
- reader.close();
- }
-
- s = getSessions().openSession();
- s.getTransaction().begin();
- s.delete( entity );
- s.getTransaction().commit();
- s.close();
-
- reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
- try {
- int num = reader.numDocs();
- assertEquals( 1, num );
- TermDocs docs = reader.termDocs( new Term( "Title", "Seam" ) );
- org.apache.lucene.document.Document doc = reader.document( docs.doc() );
- assertFalse( docs.next() );
- assertEquals( "2", doc.getField( "id" ).stringValue() );
- }
- finally {
- reader.close();
- }
-
- s = getSessions().openSession();
- s.getTransaction().begin();
- s.delete( s.createCriteria( Document.class ).uniqueResult() );
- s.getTransaction().commit();
- s.close();
- }
-
- @Test(dependsOnMethods = "testEventIntegration")
- public void testBoost() throws Exception {
- Session s = getSessions().openSession();
- s.getTransaction().begin();
- s.persist(
- new Document( "Hibernate in Action", "Object and Relational", "blah blah blah" )
- );
- s.persist(
- new Document( "Object and Relational", "Hibernate in Action", "blah blah blah" )
- );
- s.getTransaction().commit();
- s.close();
-
- IndexSearcher searcher = new IndexSearcher( new File( getBaseIndexDir(), "Documents" ).getCanonicalPath() );
- try {
- QueryParser qp = new QueryParser( "id", new StandardAnalyzer() );
- Query query = qp.parse( "title:Action OR Abstract:Action" );
- Hits hits = searcher.search( query );
- assertEquals( 2, hits.length() );
- assertTrue( hits.score( 0 ) == 2 * hits.score( 1 ) );
- assertEquals( "Hibernate in Action", hits.doc( 0 ).get( "title" ) );
- }
- finally {
- if ( searcher != null ) searcher.close();
- }
-
-
- s = getSessions().openSession();
- s.getTransaction().begin();
- List list = s.createQuery( "from Document" ).list();
- for ( Document document : (List<Document>) list ) {
- s.delete( document );
- }
- s.getTransaction().commit();
- s.close();
- }
-
- protected Class[] getMappings() {
- return new Class[]{Document.class};
- }
-
- protected void configure(org.hibernate.cfg.Configuration cfg) {
- File sub = getBaseIndexDir();
- cfg.setProperty( "hibernate.lucene.default.indexBase", sub.getAbsolutePath() );
- cfg.setProperty( "hibernate.lucene.Clock.directory_provider", "RamDirectoryProvider" );
- cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
- LuceneEventListener del = new LuceneEventListener();
- cfg.getEventListeners().setPostCommitDeleteEventListeners( new PostDeleteEventListener[]{del} );
- cfg.getEventListeners().setPostCommitUpdateEventListeners( new PostUpdateEventListener[]{del} );
- cfg.getEventListeners().setPostCommitInsertEventListeners( new PostInsertEventListener[]{del} );
- }
-
-}
-
Added: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/MappingTest.java
===================================================================
--- trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/MappingTest.java 2006-09-06 18:42:50 UTC (rev 10463)
+++ trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/MappingTest.java 2006-09-06 18:43:47 UTC (rev 10464)
@@ -0,0 +1,191 @@
+//$Id: LuceneTest.java 10014 2006-06-12 09:56:27 -0700 (lun., 12 juin 2006) epbernard $
+package org.hibernate.lucene.test;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.index.TermDocs;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.hibernate.Session;
+import org.hibernate.event.PostDeleteEventListener;
+import org.hibernate.event.PostInsertEventListener;
+import org.hibernate.event.PostUpdateEventListener;
+import org.hibernate.lucene.Environment;
+import org.hibernate.lucene.store.FSDirectoryProvider;
+import org.hibernate.lucene.event.LuceneEventListener;
+
+/**
+ * @author Gavin King
+ */
+public class MappingTest extends TestCase {
+
+
+ protected void setUp() throws Exception {
+ File sub = getBaseIndexDir();
+ sub.mkdir();
+ File[] files = sub.listFiles();
+ for (File file : files) {
+ if ( file.isDirectory() ) {
+ delete( file );
+ }
+ }
+ //super.setUp(); //we need a fresh session factory each time for index set up
+ buildSessionFactory( getMappings(), getAnnotatedPackages(), getXmlFiles() );
+ }
+
+ private File getBaseIndexDir() {
+ File current = new File( "." );
+ File sub = new File( current, "indextemp" );
+ return sub;
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ File sub = getBaseIndexDir();
+ delete( sub );
+ }
+
+ private void delete(File sub) {
+ if ( sub.isDirectory() ) {
+ for ( File file : sub.listFiles() ) {
+ delete( file );
+ }
+ sub.delete();
+ }
+ else {
+ sub.delete();
+ }
+ }
+
+ public void testEventIntegration() throws Exception {
+
+
+ Session s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.persist(
+ new Document( "Hibernate in Action", "Object/relational mapping with Hibernate", "blah blah blah" )
+ );
+ s.getTransaction().commit();
+ s.close();
+ IndexReader reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
+ try {
+ int num = reader.numDocs();
+ assertEquals( 1, num );
+ TermDocs docs = reader.termDocs( new Term( "Abstract", "Hibernate" ) );
+ org.apache.lucene.document.Document doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ docs = reader.termDocs( new Term( "Title", "Action" ) );
+ doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ assertEquals( "1", doc.getField( "id" ).stringValue() );
+ }
+ finally {
+ reader.close();
+ }
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ Document entity = (Document) s.get( Document.class, new Long( 1 ) );
+ entity.setSummary( "Object/relational mapping with EJB3" );
+ s.persist( new Document( "Seam in Action", "", "blah blah blah blah" ) );
+ s.getTransaction().commit();
+ s.close();
+
+ reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
+ try {
+ int num = reader.numDocs();
+ assertEquals( 2, num );
+ TermDocs docs = reader.termDocs( new Term( "Abstract", "EJB3" ) );
+ org.apache.lucene.document.Document doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ }
+ finally {
+ reader.close();
+ }
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
+ try {
+ int num = reader.numDocs();
+ assertEquals( 1, num );
+ TermDocs docs = reader.termDocs( new Term( "Title", "Seam" ) );
+ org.apache.lucene.document.Document doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ assertEquals( "2", doc.getField( "id" ).stringValue() );
+ }
+ finally {
+ reader.close();
+ }
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.delete( s.createCriteria( Document.class ).uniqueResult() );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testBoost() throws Exception {
+ Session s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.persist(
+ new Document( "Hibernate in Action", "Object and Relational", "blah blah blah" )
+ );
+ s.persist(
+ new Document( "Object and Relational", "Hibernate in Action", "blah blah blah" )
+ );
+ s.getTransaction().commit();
+ s.close();
+
+ IndexSearcher searcher = new IndexSearcher( new File( getBaseIndexDir(), "Documents" ).getCanonicalPath() );
+ try {
+ QueryParser qp = new QueryParser( "id", new StandardAnalyzer() );
+ Query query = qp.parse( "title:Action OR Abstract:Action" );
+ Hits hits = searcher.search( query );
+ assertEquals( 2, hits.length() );
+ assertTrue( hits.score( 0 ) == 2 * hits.score( 1 ) );
+ assertEquals( "Hibernate in Action", hits.doc( 0 ).get( "title" ) );
+ }
+ finally {
+ if ( searcher != null ) searcher.close();
+ }
+
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ List list = s.createQuery( "from Document" ).list();
+ for ( Document document : (List<Document>) list ) {
+ s.delete( document );
+ }
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ protected Class[] getMappings() {
+ return new Class[]{Document.class};
+ }
+
+ protected void configure(org.hibernate.cfg.Configuration cfg) {
+ File sub = getBaseIndexDir();
+ cfg.setProperty( "hibernate.lucene.default.indexBase", sub.getAbsolutePath() );
+ cfg.setProperty( "hibernate.lucene.Clock.directory_provider", FSDirectoryProvider.class.getName() );
+ cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+ LuceneEventListener del = new LuceneEventListener();
+ cfg.getEventListeners().setPostCommitDeleteEventListeners( new PostDeleteEventListener[]{del} );
+ cfg.getEventListeners().setPostCommitUpdateEventListeners( new PostUpdateEventListener[]{del} );
+ cfg.getEventListeners().setPostCommitInsertEventListeners( new PostInsertEventListener[]{del} );
+ }
+
+}
+
Added: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/TestCase.java
===================================================================
--- trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/TestCase.java 2006-09-06 18:42:50 UTC (rev 10463)
+++ trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/TestCase.java 2006-09-06 18:43:47 UTC (rev 10464)
@@ -0,0 +1,29 @@
+//$Id: $
+package org.hibernate.lucene.test;
+
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.hibernate.event.PostDeleteEventListener;
+import org.hibernate.event.PostInsertEventListener;
+import org.hibernate.event.PostUpdateEventListener;
+import org.hibernate.lucene.Environment;
+import org.hibernate.lucene.store.RAMDirectoryProvider;
+import org.hibernate.lucene.event.LuceneEventListener;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public abstract class TestCase extends org.hibernate.test.annotations.TestCase {
+ protected void setUp() throws Exception {
+ //super.setUp(); //we need a fresh session factory each time for index set up
+ buildSessionFactory( getMappings(), getAnnotatedPackages(), getXmlFiles() );
+ }
+
+ protected void configure(org.hibernate.cfg.Configuration cfg) {
+ cfg.setProperty( "hibernate.lucene.default.directory_provider", RAMDirectoryProvider.class.getName() );
+ cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+ LuceneEventListener del = new LuceneEventListener();
+ cfg.getEventListeners().setPostCommitDeleteEventListeners( new PostDeleteEventListener[]{del} );
+ cfg.getEventListeners().setPostCommitUpdateEventListeners( new PostUpdateEventListener[]{del} );
+ cfg.getEventListeners().setPostCommitInsertEventListeners( new PostInsertEventListener[]{del} );
+ }
+}
18 years, 4 months
Hibernate SVN: r10463 - trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 14:42:50 -0400 (Wed, 06 Sep 2006)
New Revision: 10463
Added:
trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Clock.java
trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Document.java
trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java
Log:
lucene test
Added: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Clock.java
===================================================================
--- trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Clock.java 2006-09-06 16:27:04 UTC (rev 10462)
+++ trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Clock.java 2006-09-06 18:42:50 UTC (rev 10463)
@@ -0,0 +1,41 @@
+//$Id: $
+package org.hibernate.lucene.test;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+import org.hibernate.lucene.Indexed;
+import org.hibernate.lucene.Text;
+import org.hibernate.lucene.Keyword;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+@Indexed
+public class Clock {
+ private Integer id;
+ private String brand;
+
+ public Clock(Integer id, String brand) {
+ this.id = id;
+ this.brand = brand;
+ }
+
+ @Text public String getBrand() {
+ return brand;
+ }
+
+ public void setBrand(String brand) {
+ this.brand = brand;
+ }
+
+ @Id @Keyword
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+}
Copied: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Document.java (from rev 10014, trunk/HibernateExt/metadata/src/test/org/hibernate/test/lucene/Document.java)
===================================================================
--- trunk/HibernateExt/metadata/src/test/org/hibernate/test/lucene/Document.java 2006-06-12 16:56:27 UTC (rev 10014)
+++ trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Document.java 2006-09-06 18:42:50 UTC (rev 10463)
@@ -0,0 +1,72 @@
+//$Id$
+package org.hibernate.lucene.test;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+
+import org.hibernate.lucene.Indexed;
+import org.hibernate.lucene.Keyword;
+import org.hibernate.lucene.Text;
+import org.hibernate.lucene.Unstored;
+import org.hibernate.lucene.Boost;
+
+@Entity
+@Indexed(index = "Documents")
+public class Document {
+ private Long id;
+ private String title;
+ private String summary;
+ private String text;
+
+ Document() {
+ }
+
+ public Document(String title, String summary, String text) {
+ super();
+ this.summary = summary;
+ this.text = text;
+ this.title = title;
+ }
+
+ @Id
+ @GeneratedValue
+ @Keyword(id = true)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Text
+ @Boost(2)
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ @Unstored(name = "Abstract")
+ public String getSummary() {
+ return summary;
+ }
+
+ public void setSummary(String summary) {
+ this.summary = summary;
+ }
+
+ @Lob
+ @Unstored
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
Property changes on: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/Document.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java (from rev 10014, trunk/HibernateExt/metadata/src/test/org/hibernate/test/lucene/LuceneTest.java)
===================================================================
--- trunk/HibernateExt/metadata/src/test/org/hibernate/test/lucene/LuceneTest.java 2006-06-12 16:56:27 UTC (rev 10014)
+++ trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java 2006-09-06 18:42:50 UTC (rev 10463)
@@ -0,0 +1,191 @@
+//$Id$
+package org.hibernate.lucene.test;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.index.TermDocs;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.Query;
+import org.hibernate.Session;
+import org.hibernate.event.PostDeleteEventListener;
+import org.hibernate.event.PostInsertEventListener;
+import org.hibernate.event.PostUpdateEventListener;
+import org.hibernate.lucene.Environment;
+import org.hibernate.lucene.event.LuceneEventListener;
+import org.hibernate.test.HATest;
+import static org.testng.AssertJUnit.*;
+import org.testng.annotations.Configuration;
+import org.testng.annotations.Test;
+
+/**
+ * @author Gavin King
+ */
+@Test(groups="lucene")
+public class LuceneTest extends HATest {
+
+
+ @Configuration(beforeTestClass = true)
+ protected void setUpIndex() throws Exception {
+ File sub = getBaseIndexDir();
+ sub.mkdir();
+ super.setUp();
+ }
+
+ private File getBaseIndexDir() {
+ File current = new File( "." );
+ File sub = new File( current, "indextemp" );
+ return sub;
+ }
+
+ @Configuration(afterTestClass = true)
+ protected void tearDownIndex() throws Exception {
+ File sub = getBaseIndexDir();
+ delete( sub );
+ }
+
+ private void delete(File sub) {
+ if ( sub.isDirectory() ) {
+ for ( File file : sub.listFiles() ) {
+ delete( file );
+ }
+ sub.delete();
+ }
+ else {
+ sub.delete();
+ }
+ }
+
+ @Test
+ public void testEventIntegration() throws Exception {
+
+
+ Session s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.persist(
+ new Document( "Hibernate in Action", "Object/relational mapping with Hibernate", "blah blah blah" )
+ );
+ s.getTransaction().commit();
+ s.close();
+ IndexReader reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
+ try {
+ int num = reader.numDocs();
+ assertEquals( 1, num );
+ TermDocs docs = reader.termDocs( new Term( "Abstract", "Hibernate" ) );
+ org.apache.lucene.document.Document doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ docs = reader.termDocs( new Term( "Title", "Action" ) );
+ doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ assertEquals( "1", doc.getField( "id" ).stringValue() );
+ }
+ finally {
+ reader.close();
+ }
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ Document entity = (Document) s.get( Document.class, new Long( 1 ) );
+ entity.setSummary( "Object/relational mapping with EJB3" );
+ s.persist( new Document( "Seam in Action", "", "blah blah blah blah" ) );
+ s.getTransaction().commit();
+ s.close();
+
+ reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
+ try {
+ int num = reader.numDocs();
+ assertEquals( 2, num );
+ TermDocs docs = reader.termDocs( new Term( "Abstract", "EJB3" ) );
+ org.apache.lucene.document.Document doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ }
+ finally {
+ reader.close();
+ }
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.delete( entity );
+ s.getTransaction().commit();
+ s.close();
+
+ reader = IndexReader.open( new File( getBaseIndexDir(), "Documents" ) );
+ try {
+ int num = reader.numDocs();
+ assertEquals( 1, num );
+ TermDocs docs = reader.termDocs( new Term( "Title", "Seam" ) );
+ org.apache.lucene.document.Document doc = reader.document( docs.doc() );
+ assertFalse( docs.next() );
+ assertEquals( "2", doc.getField( "id" ).stringValue() );
+ }
+ finally {
+ reader.close();
+ }
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.delete( s.createCriteria( Document.class ).uniqueResult() );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ @Test(dependsOnMethods = "testEventIntegration")
+ public void testBoost() throws Exception {
+ Session s = getSessions().openSession();
+ s.getTransaction().begin();
+ s.persist(
+ new Document( "Hibernate in Action", "Object and Relational", "blah blah blah" )
+ );
+ s.persist(
+ new Document( "Object and Relational", "Hibernate in Action", "blah blah blah" )
+ );
+ s.getTransaction().commit();
+ s.close();
+
+ IndexSearcher searcher = new IndexSearcher( new File( getBaseIndexDir(), "Documents" ).getCanonicalPath() );
+ try {
+ QueryParser qp = new QueryParser( "id", new StandardAnalyzer() );
+ Query query = qp.parse( "title:Action OR Abstract:Action" );
+ Hits hits = searcher.search( query );
+ assertEquals( 2, hits.length() );
+ assertTrue( hits.score( 0 ) == 2 * hits.score( 1 ) );
+ assertEquals( "Hibernate in Action", hits.doc( 0 ).get( "title" ) );
+ }
+ finally {
+ if ( searcher != null ) searcher.close();
+ }
+
+
+ s = getSessions().openSession();
+ s.getTransaction().begin();
+ List list = s.createQuery( "from Document" ).list();
+ for ( Document document : (List<Document>) list ) {
+ s.delete( document );
+ }
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ protected Class[] getMappings() {
+ return new Class[]{Document.class};
+ }
+
+ protected void configure(org.hibernate.cfg.Configuration cfg) {
+ File sub = getBaseIndexDir();
+ cfg.setProperty( "hibernate.lucene.default.indexBase", sub.getAbsolutePath() );
+ cfg.setProperty( "hibernate.lucene.Clock.directory_provider", "RamDirectoryProvider" );
+ cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+ LuceneEventListener del = new LuceneEventListener();
+ cfg.getEventListeners().setPostCommitDeleteEventListeners( new PostDeleteEventListener[]{del} );
+ cfg.getEventListeners().setPostCommitUpdateEventListeners( new PostUpdateEventListener[]{del} );
+ cfg.getEventListeners().setPostCommitInsertEventListeners( new PostInsertEventListener[]{del} );
+ }
+
+}
+
Property changes on: trunk/HibernateExt/metadata/src/test/org/hibernate/lucene/test/LuceneTest.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
18 years, 4 months
Hibernate SVN: r10462 - trunk/HibernateExt/ejb/src/java/org/hibernate/ejb
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 12:27:04 -0400 (Wed, 06 Sep 2006)
New Revision: 10462
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
Log:
move EntityNotFoundDelegate annonymous inner class into private class to make it Serializable
Modified: trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java
===================================================================
--- trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-09-06 16:19:12 UTC (rev 10461)
+++ trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/Ejb3Configuration.java 2006-09-06 16:27:04 UTC (rev 10462)
@@ -100,7 +100,14 @@
private static final String IMPLEMENTATION_NAME = HibernatePersistence.class.getName();
private static final String META_INF_ORM_XML = "META-INF/orm.xml";
private static Log log = LogFactory.getLog( Ejb3Configuration.class );
+ private static EntityNotFoundDelegate ejb3EntityNotFoundDelegate = new Ejb3EntityNotFoundDelegate();
+ private static class Ejb3EntityNotFoundDelegate implements EntityNotFoundDelegate, Serializable {
+ public void handleEntityNotFound(String entityName, Serializable id) {
+ throw new EntityNotFoundException("Unable to find " + entityName + " with id " + id);
+ }
+ }
+
static {
Version.touch();
}
@@ -116,12 +123,7 @@
public Ejb3Configuration() {
settingsFactory = new InjectionSettingsFactory();
cfg = new AnnotationConfiguration( settingsFactory );
- cfg.setEntityNotFoundDelegate( new EntityNotFoundDelegate() {
-
- public void handleEntityNotFound(String entityName, Serializable id) {
- throw new EntityNotFoundException("Unable to find " + entityName + " with id " + id);
- }
- } );
+ cfg.setEntityNotFoundDelegate( ejb3EntityNotFoundDelegate );
listenerConfigurator = new EventListenerConfigurator( this );
}
18 years, 4 months
Hibernate SVN: r10461 - trunk/Hibernate3/src/org/hibernate/proxy
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 12:19:12 -0400 (Wed, 06 Sep 2006)
New Revision: 10461
Modified:
trunk/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java
Log:
rollback
Modified: trunk/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java 2006-09-06 16:18:56 UTC (rev 10460)
+++ trunk/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java 2006-09-06 16:19:12 UTC (rev 10461)
@@ -7,6 +7,6 @@
*
* @author Steve Ebersole
*/
-public interface EntityNotFoundDelegate extends Serializable {
+public interface EntityNotFoundDelegate {
public void handleEntityNotFound(String entityName, Serializable id);
}
18 years, 4 months
Hibernate SVN: r10460 - branches/Branch_3_2/Hibernate3/src/org/hibernate/proxy
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 12:18:56 -0400 (Wed, 06 Sep 2006)
New Revision: 10460
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java
Log:
rollback
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java 2006-09-06 15:20:50 UTC (rev 10459)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/proxy/EntityNotFoundDelegate.java 2006-09-06 16:18:56 UTC (rev 10460)
@@ -7,6 +7,6 @@
*
* @author Steve Ebersole
*/
-public interface EntityNotFoundDelegate extends Serializable {
+public interface EntityNotFoundDelegate {
public void handleEntityNotFound(String entityName, Serializable id);
}
18 years, 4 months
Hibernate SVN: r10459 - trunk/HibernateExt/ejb-api/src/javax/persistence
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2006-09-06 11:20:50 -0400 (Wed, 06 Sep 2006)
New Revision: 10459
Modified:
trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceException.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceProperty.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnit.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnits.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PostLoad.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PostPersist.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PostRemove.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PostUpdate.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PrePersist.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PreRemove.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PreUpdate.java
trunk/HibernateExt/ejb-api/src/javax/persistence/PrimaryKeyJoinColumn.java
trunk/HibernateExt/ejb-api/src/javax/persistence/QueryHint.java
trunk/HibernateExt/ejb-api/src/javax/persistence/RollbackException.java
trunk/HibernateExt/ejb-api/src/javax/persistence/SecondaryTable.java
trunk/HibernateExt/ejb-api/src/javax/persistence/Table.java
trunk/HibernateExt/ejb-api/src/javax/persistence/Temporal.java
trunk/HibernateExt/ejb-api/src/javax/persistence/TemporalType.java
trunk/HibernateExt/ejb-api/src/javax/persistence/Transient.java
trunk/HibernateExt/ejb-api/src/javax/persistence/Version.java
Log:
EJB-211
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceException.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceException.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceException.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,5 +1,5 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss, Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -7,29 +7,44 @@
package javax.persistence;
/**
- * Comment
+ * Thrown by the persistence provider when a problem occurs. All instances of PersistenceException
+ * except for instances of NoResultException and NonUniqueResultException will cause the current
+ * transaction, if one is active, to be marked for rollback.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
- * @version $Revision$
*/
-public class PersistenceException extends RuntimeException
-{
- public PersistenceException()
- {
- }
+public class PersistenceException extends RuntimeException {
+ /**
+ * Constructs a new PersistenceException exception with null as its detail message.
+ */
+ public PersistenceException() {
+ }
- public PersistenceException(String message)
- {
- super(message);
- }
+ /**
+ * Constructs a new PersistenceException exception with the specified detail message.
+ *
+ * @param message the detail message
+ */
+ public PersistenceException(String message) {
+ super( message );
+ }
- public PersistenceException(String message, Throwable cause)
- {
- super(message, cause);
- }
+ /**
+ * Constructs a new PersistenceException exception with the specified detail message and cause
+ *
+ * @param message the detail message
+ * @param cause the cause
+ */
+ public PersistenceException(String message, Throwable cause) {
+ super( message, cause );
+ }
- public PersistenceException(Throwable cause)
- {
- super(cause);
- }
+ /**
+ * Constructs a new PersistenceException exception with the specified cause
+ *
+ * @param cause the cause
+ */
+ public PersistenceException(Throwable cause) {
+ super( cause );
+ }
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceProperty.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceProperty.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceProperty.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -16,7 +16,12 @@
@Target({})
@Retention(RUNTIME)
public @interface PersistenceProperty {
+ /**
+ * The name of the property
+ */
String name();
-
+ /**
+ * The value of the property
+ */
String value();
}
\ No newline at end of file
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnit.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnit.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnit.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,5 +1,5 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -12,15 +12,22 @@
import java.lang.annotation.Target;
/**
- * Comment
+ * Expresses a dependency on an EntityManagerFactory.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
- * @version $Revision$
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PersistenceUnit
-{
- String name() default "";
- String unitName() default "";
+public @interface PersistenceUnit {
+ /**
+ * The name by which the entity manager factory is to be accessed in the environment
+ * referencing context, and is not needed when dependency injection is used.
+ */
+ String name() default "";
+ /**
+ * The name of the persistence unit as defined in the persistence.xml file. If specified, the
+ * persistence unit for the entity manager factory that is accessible in JNDI must have the
+ * same name.
+ */
+ String unitName() default "";
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnits.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnits.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PersistenceUnits.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,5 +1,5 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -10,17 +10,17 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.persistence.PersistenceUnit;
/**
- * Comment
+ * Declares one or more PersistenceUnit annotations
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
- * @version $Revision$
*/
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PersistenceUnits
-{
- PersistenceUnit[] value();
+public @interface PersistenceUnits {
+ /**
+ * One or more PersistenceUnit annotations
+ */
+ PersistenceUnit[] value();
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PostLoad.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PostLoad.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PostLoad.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,5 +1,5 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -13,12 +13,12 @@
/**
- * comment
+ * Is used to specify callback methods for the corresponding lifecycle event. This annotation may be applied to
+ * methods of an entity class, a mapped superclass, or a callback listener class.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PostLoad
-{
+public @interface PostLoad {
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PostPersist.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PostPersist.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PostPersist.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,9 +1,10 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
+
package javax.persistence;
import java.lang.annotation.ElementType;
@@ -13,12 +14,12 @@
/**
- * comment
+ * Is used to specify callback methods for the corresponding lifecycle event. This annotation may be
+ * applied to methods of an entity class, a mapped superclass, or a callback listener class.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PostPersist
-{
+public @interface PostPersist {
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PostRemove.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PostRemove.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PostRemove.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,9 +1,10 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
+
package javax.persistence;
import java.lang.annotation.ElementType;
@@ -13,12 +14,12 @@
/**
- * comment
+ * Is used to specify callback methods for the corresponding lifecycle event. This annotation may be applied
+ * to methods of an entity class, a mapped superclass, or a callback listener class.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PostRemove
-{
+public @interface PostRemove {
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PostUpdate.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PostUpdate.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PostUpdate.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,9 +1,10 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
+
package javax.persistence;
import java.lang.annotation.ElementType;
@@ -13,12 +14,12 @@
/**
- * comment
+ * Is used to specify callback methods for the corresponding lifecycle event. This annotation may be applied to
+ * methods of an entity class, a mapped superclass, or a callback listener class.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PostUpdate
-{
+public @interface PostUpdate {
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PrePersist.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PrePersist.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PrePersist.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,9 +1,10 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
+
package javax.persistence;
import java.lang.annotation.ElementType;
@@ -13,12 +14,12 @@
/**
- * comment
+ * Is used to specify callback methods for the corresponding lifecycle event. This annotation may be applied
+ * to methods of an entity class, a mapped superclass, or a callback listener class.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PrePersist
-{
+public @interface PrePersist {
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PreRemove.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PreRemove.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PreRemove.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,9 +1,10 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
+
package javax.persistence;
import java.lang.annotation.ElementType;
@@ -13,12 +14,12 @@
/**
- * comment
+ * Is used to specify callback methods for the corresponding lifecycle event. This annotation may be applied
+ * to methods of an entity class, a mapped superclass, or a callback listener class.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PreRemove
-{
+public @interface PreRemove {
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PreUpdate.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PreUpdate.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PreUpdate.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -1,9 +1,10 @@
-/*
- * JBoss, the OpenSource J2EE webOS
+/* $Id$
+ * JBoss Inc
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
+
package javax.persistence;
import java.lang.annotation.ElementType;
@@ -13,12 +14,12 @@
/**
- * comment
+ * Is used to specify callback methods for the corresponding lifecycle event. This annotation may be
+ * applied to methods of an entity class, a mapped superclass, or a callback listener class.
*
* @author <a href="mailto:bill@jboss.org">Bill Burke</a>
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
-public @interface PreUpdate
-{
+public @interface PreUpdate {
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/PrimaryKeyJoinColumn.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/PrimaryKeyJoinColumn.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/PrimaryKeyJoinColumn.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -9,11 +9,45 @@
import static java.lang.annotation.RetentionPolicy.*;
/**
+ * This annotation specifies a primary key column that is used as a foreign key to join to another
+ * table.
+ *
+ * It is used to join the primary table of an entity subclass in the JOINED mapping strategy to
+ * the primary table of its superclass; it is used within a SecondaryTable annotation to join a
+ * secondary table to a primary table; and it may be used in a OneToOne mapping in which the
+ * primary key of the referencing entity is used as a foreign key to the referenced entity.
+ *
+ * If no PrimaryKeyJoinColumn annotation is specified for a subclass in the JOINED mapping
+ * strategy, the foreign key columns are assumed to have the same names as the primary key
+ * columns of the primary table of the superclass
+ *
* @author Emmanuel Bernard
*/
@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
public @interface PrimaryKeyJoinColumn {
+ /**
+ * The name of the primary key column of the current table.
+ *
+ * Defaults to the same name as the primary key column of the primary table of the
+ * superclass (JOINED mapping strategy); the same name as the primary key column of
+ * the primary table (SecondaryTable mapping); or the same name as the primary key
+ * column for the table for the referencing entity (OneToOne mapping)
+ */
String name() default "";
+ /**
+ * The name of the primary key column of the table being joined to.
+ *
+ * Defaults to the same name as the primary key column of the primary table of the
+ * superclass (JOINED mapping strategy); the same name as the primary key column of the
+ * primary table (SecondaryTable mapping); or the same name as the primary key column for
+ * the table for the referencing entity (OneToOne mapping)
+ */
String referencedColumnName() default "";
+ /**
+ * The SQL fragment that is used when generating the DDL for the column. This should not be
+ * specified for a OneToOne primary key association.
+ *
+ * Defaults to the generated SQL to create a column of the inferred type.
+ */
String columnDefinition() default "";
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/QueryHint.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/QueryHint.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/QueryHint.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -6,12 +6,20 @@
import java.lang.annotation.Target;
/**
+ * An implementation-specific Query hint
+ *
* @author Emmanuel Bernard
*/
@Target({})
@Retention(RUNTIME)
public @interface QueryHint {
+ /**
+ * Name of the hint
+ */
String name();
+ /**
+ * Value of the hint
+ */
String value();
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/RollbackException.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/RollbackException.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/RollbackException.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -2,23 +2,42 @@
package javax.persistence;
/**
- * Exception occurs while commiting the transaction
+ * Thrown by the persistence provider when the EntityTransaction.commit() fails
*
* @author Emmanuel Bernard
*/
public class RollbackException extends PersistenceException {
+ /**
+ * Constructs a new RollbackException exception with null as its detail message
+ */
public RollbackException() {
super();
}
+ /**
+ * Constructs a new RollbackException exception with the specified cause
+ *
+ * @param cause The detail cause
+ */
public RollbackException(Throwable cause) {
super( cause );
}
+ /**
+ * Constructs a new RollbackException exception with the specified detail message
+ *
+ * @param message The detail message
+ */
public RollbackException(String message) {
super( message );
}
+ /**
+ * Constructs a new RollbackException exception with the specified detail message and cause
+ *
+ * @param message The detail message
+ * @param cause The detail cause
+ */
public RollbackException(String message, Throwable cause) {
super( message, cause );
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/SecondaryTable.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/SecondaryTable.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/SecondaryTable.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -9,13 +9,45 @@
import static java.lang.annotation.RetentionPolicy.*;
/**
+ * This annotation is used to specify a secondary table for the annotated entity class. Specifying
+ * one or more secondary tables indicates that the data for the entity class is stored across multiple
+ * tables.
+ *
+ * If no SecondaryTable annotation is specified, it is assumed that all persistent fields or properties
+ * of the entity are mapped to the primary table. If no primary key join columns are specified, the
+ * join columns are assumed to reference the primary key columns of the primary table, and have the
+ * same names and types as the referenced primary key columns of the primary table.
+ *
* @author Emmanuel Bernard
*/
@Target({TYPE}) @Retention(RUNTIME)
public @interface SecondaryTable {
+ /**
+ * The name of the table
+ */
String name();
+ /**
+ * The catalog of the table
+ */
String catalog() default "";
+ /**
+ * The schema of the table
+ */
String schema() default "";
+ /**
+ * The columns that are used to join with the primary table.
+ *
+ * Defaults to the column(s) of the same name(s) as the primary key column(s)
+ * in the primary table
+ */
PrimaryKeyJoinColumn[] pkJoinColumns() default {};
+ /**
+ * Unique constraints that are to be placed on the table. These are typically only used if
+ * table generation is in effect. These constraints apply in addition to any constraints
+ * specified by the Column and JoinColumn annotations and constraints entailed by primary
+ * key mappings.
+ *
+ * Defaults to no additional constraints.
+ */
UniqueConstraint[] uniqueConstraints() default {};
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/Table.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/Table.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/Table.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -9,12 +9,40 @@
import static java.lang.annotation.RetentionPolicy.*;
/**
+ * This annotation specifies the primary table for the annotated entity. Additional
+ * tables may be specified using SecondaryTable or SecondaryTables annotation.
+ *
+ * If no Table annotation is specified for an entity class, the default values apply.
+ *
* @author Emmanuel Bernard
*/
@Target({TYPE}) @Retention(RUNTIME)
public @interface Table {
+ /**
+ * The name of the table.
+ *
+ * Defaults to the entity name.
+ */
String name() default "";
+ /**
+ * The catalog of the table.
+ *
+ * Defaults to the default catalog.
+ */
String catalog() default "";
+ /**
+ * The schema of the table.
+ *
+ * Defaults to the default schema for user.
+ */
String schema() default "";
+ /**
+ * Unique constraints that are to be placed on the table. These are only used if table
+ * generation is in effect. These constraints apply in addition to any constraints
+ * specified by the Column and JoinColumn annotations and constraints entailed by
+ * primary key mappings.
+ *
+ * Defaults to no additional constraints.
+ */
UniqueConstraint[] uniqueConstraints() default {};
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/Temporal.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/Temporal.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/Temporal.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -9,10 +9,18 @@
import java.lang.annotation.Target;
/**
+ * This annotation must be specified for persistent fields or properties of type Date and Calendar.
+ * It may only be specified for fields or properties of these types.
+ *
+ * The Temporal annotation may be used in conjunction with the Basic annotation.
+ *
* @author Emmanuel Bernard
*/
@Target({METHOD, FIELD})
@Retention(RUNTIME)
public @interface Temporal {
+ /**
+ * The type used in mapping java.util.Date or java.util.Calendar
+ */
TemporalType value();
}
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/TemporalType.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/TemporalType.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/TemporalType.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -2,8 +2,20 @@
//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
package javax.persistence;
+/**
+ * Type used to indicate a specific mapping of Date or Calendar.
+ */
public enum TemporalType {
- DATE, // java.sql.Date
- TIME, // java.sql.Time
- TIMESTAMP // java.sql.Timestamp
+ /**
+ * Map as java.sql.Date
+ */
+ DATE,
+ /**
+ * Map as java.sql.Time
+ */
+ TIME,
+ /**
+ * Map as java.sql.Timestamp
+ */
+ TIMESTAMP
}
\ No newline at end of file
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/Transient.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/Transient.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/Transient.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -9,6 +9,9 @@
import static java.lang.annotation.RetentionPolicy.*;
/**
+ * This annotation specifies that the property or field is not persistent. It is used to annotate
+ * a property or field of an entity class, mapped superclass, or embeddable class.
+ *
* @author Emmanuel Bernard
*/
@Target({METHOD, FIELD}) @Retention(RUNTIME)
Modified: trunk/HibernateExt/ejb-api/src/javax/persistence/Version.java
===================================================================
--- trunk/HibernateExt/ejb-api/src/javax/persistence/Version.java 2006-09-06 14:07:22 UTC (rev 10458)
+++ trunk/HibernateExt/ejb-api/src/javax/persistence/Version.java 2006-09-06 15:20:50 UTC (rev 10459)
@@ -9,6 +9,19 @@
import static java.lang.annotation.RetentionPolicy.*;
/**
+ * This annotation specifies the version field or property of an entity class that serves as its
+ * optimistic lock value. The version is used to ensure integrity when performing the merge
+ * operation and for optimistic concurrency control.
+ *
+ * Only a single Version property or field should be used per class; applications that use more
+ * than one Version property or field will not be portable.
+ *
+ * The Version property should be mapped to the primary table for the entity class; applications
+ * that map the Version property to a table other than the primary table will not be portable.
+ *
+ * The following types are supported for version properties: int, Integer, short, Short, long,
+ * Long, Timestamp.
+ *
* @author Emmanuel Bernard
*/
@Target({METHOD, FIELD}) @Retention(RUNTIME)
18 years, 4 months