Subversion Repositories WebE

Compare Revisions

Last modification

Ignore whitespace Rev 32 → Rev 33

/trunk/.project
34,11 → 34,4
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
<linkedResources>
<link>
<name>hibernate-src</name>
<type>2</type>
<locationURI>WORKSPACE_LOC/Hibernate3/src</locationURI>
</link>
</linkedResources>
</projectDescription>
/trunk/src/hibernate.cfg.xml
28,7 → 28,7
<!--<property name="hbm2ddl.auto">create</property> -->
<mapping class="ch.ffhs.webE.domain.ActionType" />
<mapping class="ch.ffhs.webE.domain.History" />
<mapping class="ch.ffhs.webE.domain.Object" />
<mapping class="ch.ffhs.webE.domain.ObjectEntity" />
<mapping class="ch.ffhs.webE.domain.ObjectType" />
<mapping class="ch.ffhs.webE.domain.Relationship" />
<mapping class="ch.ffhs.webE.domain.RelationshipType" />
/trunk/src/struts.xml
12,10 → 12,26
<result>/user/termAddForm.jsp</result>
</action>
 
<action name="doTermAdd" method="addOrUpdate"
<action name="doTermAdd" method="add"
class="ch.ffhs.webE.action.TermAction">
<result name="success">/user/termAdd.jsp</result>
<result name="error">/user/termAddForm.jsp</result>
</action>
 
<action name="termList" method="list"
class="ch.ffhs.webE.action.TermAction">
<result name="success">/user/termList.jsp</result>
</action>
 
<action name="deleteTerm" method="delete"
class="ch.ffhs.webE.action.TermAction">
<result name="success" type="redirect">/user/termList</result>
</action>
 
<action name="editTerm" method="edit"
class="ch.ffhs.webE.action.TermAction">
<result name="success">/user/termAddForm.jsp</result>
</action>
</package>
 
<!-- Admin environment -->
/trunk/src/org/hibernate/StatelessSession.java
New file
0,0 → 1,240
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate;
 
import java.io.Serializable;
import java.sql.Connection;
 
/**
* A command-oriented API for performing bulk operations
* against a database.<br>
* <br>
* A stateless session does not implement a first-level cache nor
* interact with any second-level cache, nor does it implement
* transactional write-behind or automatic dirty checking, nor do
* operations cascade to associated instances. Collections are
* ignored by a stateless session. Operations performed via a
* stateless session bypass Hibernate's event model and
* interceptors. Stateless sessions are vulnerable to data
* aliasing effects, due to the lack of a first-level cache.<br>
* <br>
* For certain kinds of transactions, a stateless session may
* perform slightly faster than a stateful session.
*
* @author Gavin King
*/
public interface StatelessSession extends Serializable {
/**
* Close the stateless session and release the JDBC connection.
*/
public void close();
 
/**
* Insert a row.
*
* @param entity a new transient instance
*/
public Serializable insert(Object entity);
 
/**
* Insert a row.
*
* @param entityName The entityName for the entity to be inserted
* @param entity a new transient instance
* @return the identifier of the instance
*/
public Serializable insert(String entityName, Object entity);
 
/**
* Update a row.
*
* @param entity a detached entity instance
*/
public void update(Object entity);
 
/**
* Update a row.
*
* @param entityName The entityName for the entity to be updated
* @param entity a detached entity instance
*/
public void update(String entityName, Object entity);
 
/**
* Delete a row.
*
* @param entity a detached entity instance
*/
public void delete(Object entity);
 
/**
* Delete a row.
*
* @param entityName The entityName for the entity to be deleted
* @param entity a detached entity instance
*/
public void delete(String entityName, Object entity);
 
/**
* Retrieve a row.
*
* @return a detached entity instance
*/
public Object get(String entityName, Serializable id);
 
/**
* Retrieve a row.
*
* @return a detached entity instance
*/
public Object get(Class entityClass, Serializable id);
 
/**
* Retrieve a row, obtaining the specified lock mode.
*
* @return a detached entity instance
*/
public Object get(String entityName, Serializable id, LockMode lockMode);
 
/**
* Retrieve a row, obtaining the specified lock mode.
*
* @return a detached entity instance
*/
public Object get(Class entityClass, Serializable id, LockMode lockMode);
 
/**
* Refresh the entity instance state from the database.
*
* @param entity The entity to be refreshed.
*/
public void refresh(Object entity);
 
/**
* Refresh the entity instance state from the database.
*
* @param entityName The entityName for the entity to be refreshed.
* @param entity The entity to be refreshed.
*/
public void refresh(String entityName, Object entity);
 
/**
* Refresh the entity instance state from the database.
*
* @param entity The entity to be refreshed.
* @param lockMode The LockMode to be applied.
*/
public void refresh(Object entity, LockMode lockMode);
 
/**
* Refresh the entity instance state from the database.
*
* @param entityName The entityName for the entity to be refreshed.
* @param entity The entity to be refreshed.
* @param lockMode The LockMode to be applied.
*/
public void refresh(String entityName, Object entity, LockMode lockMode);
 
/**
* Create a new instance of <tt>Query</tt> for the given HQL query string.
* Entities returned by the query are detached.
*/
public Query createQuery(String queryString);
 
/**
* Obtain an instance of <tt>Query</tt> for a named query string defined in
* the mapping file. Entities returned by the query are detached.
*/
public Query getNamedQuery(String queryName);
 
/**
* Create a new <tt>Criteria</tt> instance, for the given entity class,
* or a superclass of an entity class. Entities returned by the query are
* detached.
*
* @param persistentClass a class, which is persistent, or has persistent subclasses
* @return Criteria
*/
public Criteria createCriteria(Class persistentClass);
 
/**
* Create a new <tt>Criteria</tt> instance, for the given entity class,
* or a superclass of an entity class, with the given alias.
* Entities returned by the query are detached.
*
* @param persistentClass a class, which is persistent, or has persistent subclasses
* @return Criteria
*/
public Criteria createCriteria(Class persistentClass, String alias);
 
/**
* Create a new <tt>Criteria</tt> instance, for the given entity name.
* Entities returned by the query are detached.
*
* @param entityName
* @return Criteria
*/
public Criteria createCriteria(String entityName);
 
/**
* Create a new <tt>Criteria</tt> instance, for the given entity name,
* with the given alias. Entities returned by the query are detached.
*
* @param entityName
* @return Criteria
*/
public Criteria createCriteria(String entityName, String alias);
 
/**
* Create a new instance of <tt>SQLQuery</tt> for the given SQL query string.
* Entities returned by the query are detached.
*
* @param queryString a SQL query
* @return SQLQuery
* @throws HibernateException
*/
public SQLQuery createSQLQuery(String queryString) throws HibernateException;
 
/**
* Begin a Hibernate transaction.
*/
public Transaction beginTransaction();
 
/**
* Get the current Hibernate transaction.
*/
public Transaction getTransaction();
 
/**
* Returns the current JDBC connection associated with this
* instance.<br>
* <br>
* If the session is using aggressive connection release (as in a
* CMT environment), it is the application's responsibility to
* close the connection returned by this call. Otherwise, the
* application should not close the connection.
*/
public Connection connection();
}
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/CallbackException.java
===================================================================
--- src/org/hibernate/CallbackException.java (revision 0)
+++ src/org/hibernate/CallbackException.java (revision 33)
@@ -0,0 +1,56 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Should be thrown by persistent objects from <tt>Lifecycle</tt>
+ * or <tt>Interceptor</tt> callbacks.
+ *
+ * @see org.hibernate.classic.Lifecycle
+ * @see Interceptor
+ * @author Gavin King
+ */
+
+public class CallbackException extends HibernateException {
+
+ public CallbackException(Exception root) {
+ super("An exception occurred in a callback", root);
+ }
+
+ public CallbackException(String message) {
+ super(message);
+ }
+
+ public CallbackException(String message, Exception e) {
+ super(message, e);
+ }
+
+}
+
+
+
+
+
+
/src/org/hibernate/CallbackException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/ObjectDeletedException.java
===================================================================
--- src/org/hibernate/ObjectDeletedException.java (revision 0)
+++ src/org/hibernate/ObjectDeletedException.java (revision 33)
@@ -0,0 +1,48 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+/**
+ * Thrown when the user tries to do something illegal with a deleted
+ * object.
+ *
+ * @author Gavin King
+ */
+public class ObjectDeletedException extends UnresolvableObjectException {
+
+ public ObjectDeletedException(String message, Serializable identifier, String clazz) {
+ super(message, identifier, clazz);
+ }
+
+}
+
+
+
+
+
+
+
/src/org/hibernate/ObjectDeletedException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/package.html
===================================================================
--- src/org/hibernate/package.html (revision 0)
+++ src/org/hibernate/package.html (revision 33)
@@ -0,0 +1,33 @@
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ ~
+ -->
+
+<html>
+<head></head>
+<body>
+<p>
+ This package defines the central Hibernate APIs.
+</p>
+</body>
+</html>
/src/org/hibernate/package.html
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/ReplicationMode.java
===================================================================
--- src/org/hibernate/ReplicationMode.java (revision 0)
+++ src/org/hibernate/ReplicationMode.java (revision 33)
@@ -0,0 +1,101 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hibernate.type.VersionType;
+
+/**
+ * Represents a replication strategy.
+ *
+ * @see Session#replicate(Object, ReplicationMode)
+ * @author Gavin King
+ */
+public abstract class ReplicationMode implements Serializable {
+ private final String name;
+ private static final Map INSTANCES = new HashMap();
+
+ public ReplicationMode(String name) {
+ this.name=name;
+ }
+ public String toString() {
+ return name;
+ }
+ public abstract boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType);
+ /**
+ * Throw an exception when a row already exists.
+ */
+ public static final ReplicationMode EXCEPTION = new ReplicationMode("EXCEPTION") {
+ public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
+ throw new AssertionFailure("should not be called");
+ }
+ };
+ /**
+ * Ignore replicated entities when a row already exists.
+ */
+ public static final ReplicationMode IGNORE = new ReplicationMode("IGNORE") {
+ public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
+ return false;
+ }
+ };
+ /**
+ * Overwrite existing rows when a row already exists.
+ */
+ public static final ReplicationMode OVERWRITE = new ReplicationMode("OVERWRITE") {
+ public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
+ return true;
+ }
+ };
+ /**
+ * When a row already exists, choose the latest version.
+ */
+ public static final ReplicationMode LATEST_VERSION = new ReplicationMode("LATEST_VERSION") {
+ public boolean shouldOverwriteCurrentVersion(Object entity, Object currentVersion, Object newVersion, VersionType versionType) {
+ if (versionType==null) return true; //always overwrite nonversioned data
+ return versionType.getComparator().compare(currentVersion, newVersion) <= 0;
+ }
+ };
+
+ static {
+ INSTANCES.put( LATEST_VERSION.name, LATEST_VERSION );
+ INSTANCES.put( IGNORE.name, IGNORE );
+ INSTANCES.put( OVERWRITE.name, OVERWRITE );
+ INSTANCES.put( EXCEPTION.name, EXCEPTION );
+ }
+
+ private Object readResolve() {
+ return INSTANCES.get(name);
+ }
+
+}
+
+
+
+
+
+
/src/org/hibernate/ReplicationMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/StaleObjectStateException.java
===================================================================
--- src/org/hibernate/StaleObjectStateException.java (revision 0)
+++ src/org/hibernate/StaleObjectStateException.java (revision 33)
@@ -0,0 +1,68 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+import org.hibernate.pretty.MessageHelper;
+
+/**
+ * A <tt>StaleStateException</tt> that carries information
+ * about a particular entity instance that was the source
+ * of the failure.
+ *
+ * @author Gavin King
+ */
+public class StaleObjectStateException extends StaleStateException {
+ private final String entityName;
+ private final Serializable identifier;
+
+ public StaleObjectStateException(String persistentClass, Serializable identifier) {
+ super("Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)");
+ this.entityName = persistentClass;
+ this.identifier = identifier;
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+ public Serializable getIdentifier() {
+ return identifier;
+ }
+
+ public String getMessage() {
+ return super.getMessage() + ": " +
+ MessageHelper.infoString(entityName, identifier);
+ }
+
+}
+
+
+
+
+
+
+
/src/org/hibernate/StaleObjectStateException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/HibernateException.java
===================================================================
--- src/org/hibernate/HibernateException.java (revision 0)
+++ src/org/hibernate/HibernateException.java (revision 33)
@@ -0,0 +1,57 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import org.hibernate.exception.NestableRuntimeException;
+
+/**
+ * Any exception that occurs inside the persistence layer
+ * or JDBC driver. <tt>SQLException</tt>s are always wrapped
+ * by instances of <tt>JDBCException</tt>.
+ *
+ * @see JDBCException
+ * @author Gavin King
+ */
+
+public class HibernateException extends NestableRuntimeException {
+
+ public HibernateException(Throwable root) {
+ super(root);
+ }
+
+ public HibernateException(String string, Throwable root) {
+ super(string, root);
+ }
+
+ public HibernateException(String s) {
+ super(s);
+ }
+}
+
+
+
+
+
+
/src/org/hibernate/HibernateException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/JDBCException.java
===================================================================
--- src/org/hibernate/JDBCException.java (revision 0)
+++ src/org/hibernate/JDBCException.java (revision 33)
@@ -0,0 +1,86 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.sql.SQLException;
+
+
+/**
+ * Wraps an <tt>SQLException</tt>. Indicates that an exception
+ * occurred during a JDBC call.
+ *
+ * @see java.sql.SQLException
+ * @author Gavin King
+ */
+public class JDBCException extends HibernateException {
+
+ private SQLException sqle;
+ private String sql;
+
+ public JDBCException(String string, SQLException root) {
+ super(string, root);
+ sqle=root;
+ }
+
+ public JDBCException(String string, SQLException root, String sql) {
+ this(string, root);
+ this.sql = sql;
+ }
+
+ /**
+ * Get the SQLState of the underlying <tt>SQLException</tt>.
+ * @see java.sql.SQLException
+ * @return String
+ */
+ public String getSQLState() {
+ return sqle.getSQLState();
+ }
+
+ /**
+ * Get the <tt>errorCode</tt> of the underlying <tt>SQLException</tt>.
+ * @see java.sql.SQLException
+ * @return int the error code
+ */
+ public int getErrorCode() {
+ return sqle.getErrorCode();
+ }
+
+ /**
+ * Get the underlying <tt>SQLException</tt>.
+ * @return SQLException
+ */
+ public SQLException getSQLException() {
+ return sqle;
+ }
+
+ /**
+ * Get the actual SQL statement that caused the exception
+ * (may be null)
+ */
+ public String getSQL() {
+ return sql;
+ }
+
+}
/src/org/hibernate/JDBCException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/InvalidMappingException.java
===================================================================
--- src/org/hibernate/InvalidMappingException.java (revision 0)
+++ src/org/hibernate/InvalidMappingException.java (revision 33)
@@ -0,0 +1,66 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown when a mapping is found to be invalid.
+ * Similar to MappingException, but this contains more info about the path and type of mapping (e.g. file, resource or url)
+ *
+ * @author Max Rydahl Andersen
+ *
+ */
+public class InvalidMappingException extends MappingException {
+
+ private final String path;
+ private final String type;
+
+ public InvalidMappingException(String customMessage, String type, String path, Throwable cause) {
+ super(customMessage, cause);
+ this.type=type;
+ this.path=path;
+ }
+
+ public InvalidMappingException(String customMessage, String type, String path) {
+ super(customMessage);
+ this.type=type;
+ this.path=path;
+ }
+
+ public InvalidMappingException(String type, String path) {
+ this("Could not parse mapping document from " + type + (path==null?"":" " + path), type, path);
+ }
+
+ public InvalidMappingException(String type, String path, Throwable cause) {
+ this("Could not parse mapping document from " + type + (path==null?"":" " + path), type, path, cause);
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getPath() {
+ return path;
+ }
+}
/src/org/hibernate/InvalidMappingException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/SessionFactoryObserver.java
===================================================================
--- src/org/hibernate/SessionFactoryObserver.java (revision 0)
+++ src/org/hibernate/SessionFactoryObserver.java (revision 33)
@@ -0,0 +1,49 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+/**
+ * Allows reaction to basic {@link SessionFactory} occurrences.
+ *
+ * @author Steve Ebersole
+ */
+public interface SessionFactoryObserver extends Serializable {
+ /**
+ * Callback to indicate that the given factory has been created and is now ready for use.
+ *
+ * @param factory The factory initialized.
+ */
+ public void sessionFactoryCreated(SessionFactory factory);
+
+ /**
+ * Callback to indicate that the given factory has been closed. Care should be taken
+ * in how (if at all) the passed factory reference is used since it is closed.
+ *
+ * @param factory The factory closed.
+ */
+ public void sessionFactoryClosed(SessionFactory factory);
+}
/src/org/hibernate/SessionFactoryObserver.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/QueryParameterException.java
===================================================================
--- src/org/hibernate/QueryParameterException.java (revision 0)
+++ src/org/hibernate/QueryParameterException.java (revision 33)
@@ -0,0 +1,49 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Parameter invalid or not found in the query
+ *
+ * @author Emmanuel Bernard
+ */
+public class QueryParameterException extends QueryException {
+
+ public QueryParameterException(Exception e) {
+ super( e );
+ }
+
+ public QueryParameterException(String message) {
+ super( message );
+ }
+
+ public QueryParameterException(String message, Throwable e) {
+ super( message, e );
+ }
+
+ public QueryParameterException(String message, String queryString) {
+ super( message, queryString );
+ }
+}
/src/org/hibernate/QueryParameterException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/PropertyAccessException.java
===================================================================
--- src/org/hibernate/PropertyAccessException.java (revision 0)
+++ src/org/hibernate/PropertyAccessException.java (revision 33)
@@ -0,0 +1,73 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import org.hibernate.util.StringHelper;
+
+/**
+ * A problem occurred accessing a property of an instance of a
+ * persistent class by reflection, or via CGLIB. There are a
+ * number of possible underlying causes, including
+ * <ul>
+ * <li>failure of a security check
+ * <li>an exception occurring inside the getter or setter method
+ * <li>a nullable database column was mapped to a primitive-type property
+ * <li>the Hibernate type was not castable to the property type (or vice-versa)
+ * </ul>
+ * @author Gavin King
+ */
+public class PropertyAccessException extends HibernateException {
+
+ private final Class persistentClass;
+ private final String propertyName;
+ private final boolean wasSetter;
+
+ public PropertyAccessException(Throwable root, String s, boolean wasSetter, Class persistentClass, String propertyName) {
+ super(s, root);
+ this.persistentClass = persistentClass;
+ this.wasSetter = wasSetter;
+ this.propertyName = propertyName;
+ }
+
+ public Class getPersistentClass() {
+ return persistentClass;
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public String getMessage() {
+ return super.getMessage() +
+ ( wasSetter ? " setter of " : " getter of ") +
+ StringHelper.qualify( persistentClass.getName(), propertyName );
+ }
+}
+
+
+
+
+
+
/src/org/hibernate/PropertyAccessException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/FlushMode.java
===================================================================
--- src/org/hibernate/FlushMode.java (revision 0)
+++ src/org/hibernate/FlushMode.java (revision 33)
@@ -0,0 +1,115 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Represents a flushing strategy. The flush process synchronizes
+ * database state with session state by detecting state changes
+ * 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 {
+ private static final Map INSTANCES = new HashMap();
+
+ private final int level;
+ private final String name;
+
+ private FlushMode(int level, String name) {
+ this.level = level;
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * 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.
+ *
+ * @deprecated use {@link #MANUAL} instead.
+ */
+ public static final FlushMode NEVER = new FlushMode( 0, "NEVER" );
+
+ /**
+ * 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 {@link Session} is flushed when {@link Transaction#commit}
+ * is called.
+ */
+ public static final FlushMode COMMIT = new FlushMode(5, "COMMIT");
+
+ /**
+ * 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 {@link Session} is flushed before every query. This is
+ * almost always unnecessary and inefficient.
+ */
+ public static final FlushMode ALWAYS = new FlushMode(20, "ALWAYS");
+
+ public boolean lessThan(FlushMode other) {
+ return this.level<other.level;
+ }
+
+ static {
+ INSTANCES.put( NEVER.name, NEVER );
+ INSTANCES.put( MANUAL.name, MANUAL );
+ INSTANCES.put( AUTO.name, AUTO );
+ INSTANCES.put( ALWAYS.name, ALWAYS );
+ INSTANCES.put( COMMIT.name, COMMIT );
+ }
+
+ public static boolean isManualFlushMode(FlushMode mode) {
+ return MANUAL.level == mode.level;
+ }
+
+ private Object readResolve() {
+ return INSTANCES.get( name );
+ }
+
+ public static FlushMode parse(String name) {
+ return ( FlushMode ) INSTANCES.get( name );
+ }
+}
/src/org/hibernate/FlushMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/TypeMismatchException.java
===================================================================
--- src/org/hibernate/TypeMismatchException.java (revision 0)
+++ src/org/hibernate/TypeMismatchException.java (revision 33)
@@ -0,0 +1,44 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Used when a user provided type does not match the expected one
+ *
+ * @author Emmanuel Bernard
+ */
+public class TypeMismatchException extends HibernateException {
+ public TypeMismatchException(Throwable root) {
+ super( root );
+ }
+
+ public TypeMismatchException(String s) {
+ super( s );
+ }
+
+ public TypeMismatchException(String string, Throwable root) {
+ super( string, root );
+ }
+}
/src/org/hibernate/TypeMismatchException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/StaleStateException.java
===================================================================
--- src/org/hibernate/StaleStateException.java (revision 0)
+++ src/org/hibernate/StaleStateException.java (revision 33)
@@ -0,0 +1,44 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown when a version number or timestamp check failed, indicating that the
+ * <tt>Session</tt> contained stale data (when using long transactions
+ * with versioning). Also occurs if we try delete or update a row that does
+ * not exist.<br>
+ * <br>
+ * Note that this exception often indicates that the user failed to specify the
+ * correct <tt>unsaved-value</tt> strategy for a class!
+ *
+ * @see StaleObjectStateException
+ * @author Gavin King
+ */
+public class StaleStateException extends HibernateException {
+
+ public StaleStateException(String s) {
+ super(s);
+ }
+}
/src/org/hibernate/StaleStateException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/FetchMode.java
===================================================================
--- src/org/hibernate/FetchMode.java (revision 0)
+++ src/org/hibernate/FetchMode.java (revision 33)
@@ -0,0 +1,93 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Represents an association fetching strategy. This is used
+ * together with the <tt>Criteria</tt> API to specify runtime
+ * fetching strategies.<br>
+ * <br>
+ * For HQL queries, use the <tt>FETCH</tt> keyword instead.
+ *
+ * @see Criteria#setFetchMode(java.lang.String, FetchMode)
+ * @author Gavin King
+ */
+public final class FetchMode implements Serializable {
+ private final String name;
+ private static final Map INSTANCES = new HashMap();
+
+ private FetchMode(String name) {
+ this.name=name;
+ }
+ public String toString() {
+ return name;
+ }
+ /**
+ * Default to the setting configured in the mapping file.
+ */
+ public static final FetchMode DEFAULT = new FetchMode("DEFAULT");
+
+ /**
+ * Fetch using an outer join. Equivalent to <tt>fetch="join"</tt>.
+ */
+ public static final FetchMode JOIN = new FetchMode("JOIN");
+ /**
+ * Fetch eagerly, using a separate select. Equivalent to
+ * <tt>fetch="select"</tt>.
+ */
+ public static final FetchMode SELECT = new FetchMode("SELECT");
+
+ /**
+ * Fetch lazily. Equivalent to <tt>outer-join="false"</tt>.
+ * @deprecated use <tt>FetchMode.SELECT</tt>
+ */
+ public static final FetchMode LAZY = SELECT;
+ /**
+ * Fetch eagerly, using an outer join. Equivalent to
+ * <tt>outer-join="true"</tt>.
+ * @deprecated use <tt>FetchMode.JOIN</tt>
+ */
+ public static final FetchMode EAGER = JOIN;
+
+ static {
+ INSTANCES.put( JOIN.name, JOIN );
+ INSTANCES.put( SELECT.name, SELECT );
+ INSTANCES.put( DEFAULT.name, DEFAULT );
+ }
+
+ private Object readResolve() {
+ return INSTANCES.get(name);
+ }
+
+}
+
+
+
+
+
/src/org/hibernate/FetchMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/ObjectNotFoundException.java
===================================================================
--- src/org/hibernate/ObjectNotFoundException.java (revision 0)
+++ src/org/hibernate/ObjectNotFoundException.java (revision 33)
@@ -0,0 +1,47 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+/**
+ * Thrown when <tt>Session.load()</tt> fails to select a row with
+ * the given primary key (identifier value). This exception might not
+ * be thrown when <tt>load()</tt> is called, even if there was no
+ * row on the database, because <tt>load()</tt> returns a proxy if
+ * possible. Applications should use <tt>Session.get()</tt> to test if
+ * a row exists in the database.<br>
+ * <br>
+ * Like all Hibernate exceptions, this exception is considered
+ * unrecoverable.
+ *
+ * @author Gavin King
+ */
+public class ObjectNotFoundException extends UnresolvableObjectException {
+
+ public ObjectNotFoundException(Serializable identifier, String clazz) {
+ super(identifier, clazz);
+ }
+}
/src/org/hibernate/ObjectNotFoundException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/InstantiationException.java
===================================================================
--- src/org/hibernate/InstantiationException.java (revision 0)
+++ src/org/hibernate/InstantiationException.java (revision 33)
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown if Hibernate can't instantiate an entity or component
+ * class at runtime.
+ *
+ * @author Gavin King
+ */
+
+public class InstantiationException extends HibernateException {
+
+ private final Class clazz;
+
+ public InstantiationException(String s, Class clazz, Throwable root) {
+ super(s, root);
+ this.clazz = clazz;
+ }
+
+ public InstantiationException(String s, Class clazz) {
+ super(s);
+ this.clazz = clazz;
+ }
+
+ public InstantiationException(String s, Class clazz, Exception e) {
+ super(s, e);
+ this.clazz = clazz;
+ }
+
+ public Class getPersistentClass() {
+ return clazz;
+ }
+
+ public String getMessage() {
+ return super.getMessage() + clazz.getName();
+ }
+
+}
+
+
+
+
+
+
/src/org/hibernate/InstantiationException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/ScrollMode.java
===================================================================
--- src/org/hibernate/ScrollMode.java (revision 0)
+++ src/org/hibernate/ScrollMode.java (revision 33)
@@ -0,0 +1,97 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.sql.ResultSet;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Specifies the type of JDBC scrollable result set to use
+ * underneath a <tt>ScrollableResults</tt>
+ *
+ * @see Query#scroll(ScrollMode)
+ * @see ScrollableResults
+ * @author Gavin King
+ */
+public final class ScrollMode implements Serializable {
+ private final int resultSetType;
+ private final String name;
+ private static final Map INSTANCES = new HashMap();
+
+ private ScrollMode(int level, String name) {
+ this.resultSetType=level;
+ this.name=name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * @return the JDBC result set type code
+ */
+ public int toResultSetType() {
+ return resultSetType;
+ }
+
+ /**
+ * @see java.sql.ResultSet.TYPE_FORWARD_ONLY
+ */
+ public static final ScrollMode FORWARD_ONLY = new ScrollMode(ResultSet.TYPE_FORWARD_ONLY, "FORWARD_ONLY");
+ /**
+ * @see java.sql.ResultSet.TYPE_SCROLL_SENSITIVE
+ */
+ public static final ScrollMode SCROLL_SENSITIVE = new ScrollMode(ResultSet.TYPE_SCROLL_SENSITIVE, "SCROLL_SENSITIVE");
+ /**
+ * Note that since the Hibernate session acts as a cache, you
+ * might need to expicitly evict objects, if you need to see
+ * changes made by other transactions.
+ * @see java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE
+ */
+ public static final ScrollMode SCROLL_INSENSITIVE = new ScrollMode(ResultSet.TYPE_SCROLL_INSENSITIVE, "SCROLL_INSENSITIVE");
+
+ public boolean lessThan(ScrollMode other) {
+ return this.resultSetType<other.resultSetType;
+ }
+
+ static {
+ INSTANCES.put( FORWARD_ONLY.name, FORWARD_ONLY );
+ INSTANCES.put( SCROLL_INSENSITIVE.name, SCROLL_INSENSITIVE );
+ INSTANCES.put( SCROLL_SENSITIVE.name, SCROLL_SENSITIVE );
+ }
+
+ private Object readResolve() {
+ return INSTANCES.get(name);
+ }
+
+}
+
+
+
+
+
+
/src/org/hibernate/ScrollMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/ScrollableResults.java
===================================================================
--- src/org/hibernate/ScrollableResults.java (revision 0)
+++ src/org/hibernate/ScrollableResults.java (revision 33)
@@ -0,0 +1,227 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.hibernate.type.Type;
+
+/**
+ * A result iterator that allows moving around within the results
+ * by arbitrary increments. The <tt>Query</tt> / <tt>ScrollableResults</tt>
+ * pattern is very similar to the JDBC <tt>PreparedStatement</tt>/
+ * <tt>ResultSet</tt> pattern and the semantics of methods of this interface
+ * are similar to the similarly named methods on <tt>ResultSet</tt>.<br>
+ * <br>
+ * Contrary to JDBC, columns of results are numbered from zero.
+ *
+ * @see Query#scroll()
+ * @author Gavin King
+ */
+public interface ScrollableResults {
+ /**
+ * Advance to the next result
+ * @return <tt>true</tt> if there is another result
+ */
+ public boolean next() throws HibernateException;
+ /**
+ * Retreat to the previous result
+ * @return <tt>true</tt> if there is a previous result
+ */
+ public boolean previous() throws HibernateException;
+ /**
+ * Scroll an arbitrary number of locations
+ * @param i a positive (forward) or negative (backward) number of rows
+ * @return <tt>true</tt> if there is a result at the new location
+ */
+ public boolean scroll(int i) throws HibernateException;
+ /**
+ * Go to the last result
+ * @return <tt>true</tt> if there are any results
+ */
+ public boolean last() throws HibernateException;
+ /**
+ * Go to the first result
+ * @return <tt>true</tt> if there are any results
+ */
+ public boolean first() throws HibernateException;
+ /**
+ * Go to a location just before first result (this is the initial location)
+ */
+ public void beforeFirst() throws HibernateException;
+ /**
+ * Go to a location just after the last result
+ */
+ public void afterLast() throws HibernateException;
+ /**
+ * Is this the first result?
+ *
+ * @return <tt>true</tt> if this is the first row of results
+ * @throws HibernateException
+ */
+ public boolean isFirst() throws HibernateException;
+ /**
+ * Is this the last result?
+ *
+ * @return <tt>true</tt> if this is the last row of results
+ * @throws HibernateException
+ */
+ public boolean isLast() throws HibernateException;
+ /**
+ * Release resources immediately.
+ */
+ public void close() throws HibernateException;
+ /**
+ * Get the current row of results
+ * @return an object or array
+ */
+ public Object[] get() throws HibernateException;
+ /**
+ * Get the <tt>i</tt>th object in the current row of results, without
+ * initializing any other results in the row. This method may be used
+ * safely, regardless of the type of the column (ie. even for scalar
+ * results).
+ * @param i the column, numbered from zero
+ * @return an object of any Hibernate type or <tt>null</tt>
+ */
+ public Object get(int i) throws HibernateException;
+
+ /**
+ * Get the type of the <tt>i</tt>th column of results
+ * @param i the column, numbered from zero
+ * @return the Hibernate type
+ */
+ public Type getType(int i);
+
+ /**
+ * Convenience method to read an <tt>integer</tt>
+ */
+ public Integer getInteger(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>long</tt>
+ */
+ public Long getLong(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>float</tt>
+ */
+ public Float getFloat(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>boolean</tt>
+ */
+ public Boolean getBoolean(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>double</tt>
+ */
+ public Double getDouble(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>short</tt>
+ */
+ public Short getShort(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>byte</tt>
+ */
+ public Byte getByte(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>character</tt>
+ */
+ public Character getCharacter(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>binary</tt>
+ */
+ public byte[] getBinary(int col) throws HibernateException;
+ /**
+ * Convenience method to read <tt>text</tt>
+ */
+ public String getText(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>blob</tt>
+ */
+ public Blob getBlob(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>clob</tt>
+ */
+ public Clob getClob(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>string</tt>
+ */
+ public String getString(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>big_decimal</tt>
+ */
+ public BigDecimal getBigDecimal(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>big_integer</tt>
+ */
+ public BigInteger getBigInteger(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>date</tt>, <tt>time</tt> or <tt>timestamp</tt>
+ */
+ public Date getDate(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>locale</tt>
+ */
+ public Locale getLocale(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>calendar</tt> or <tt>calendar_date</tt>
+ */
+ public Calendar getCalendar(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>currency</tt>
+ */
+ //public Currency getCurrency(int col) throws HibernateException;
+ /**
+ * Convenience method to read a <tt>timezone</tt>
+ */
+ public TimeZone getTimeZone(int col) throws HibernateException;
+ /**
+ * Get the current location in the result set. The first
+ * row is number <tt>0</tt>, contrary to JDBC.
+ * @return the row number, numbered from <tt>0</tt>, or <tt>-1</tt> if
+ * there is no current row
+ */
+ public int getRowNumber() throws HibernateException;
+ /**
+ * Set the current location in the result set, numbered from either the
+ * first row (row number <tt>0</tt>), or the last row (row
+ * number <tt>-1</tt>).
+ * @param rowNumber the row number, numbered from the last row, in the
+ * case of a negative row number
+ * @return true if there is a row at that row number
+ */
+ public boolean setRowNumber(int rowNumber) throws HibernateException;
+}
+
+
+
+
+
+
/src/org/hibernate/ScrollableResults.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/Query.java
===================================================================
--- src/org/hibernate/Query.java (revision 0)
+++ src/org/hibernate/Query.java (revision 33)
@@ -0,0 +1,409 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.hibernate.transform.ResultTransformer;
+import org.hibernate.type.Type;
+
+/**
+ * An object-oriented representation of a Hibernate query. A <tt>Query</tt>
+ * instance is obtained by calling <tt>Session.createQuery()</tt>. This
+ * interface exposes some extra functionality beyond that provided by
+ * <tt>Session.iterate()</tt> and <tt>Session.find()</tt>:
+ * <ul>
+ * <li>a particular page of the result set may be selected by calling <tt>
+ * setMaxResults(), setFirstResult()</tt>
+ * <li>named query parameters may be used
+ * <li>the results may be returned as an instance of <tt>ScrollableResults</tt>
+ * </ul>
+ * <br>
+ * Named query parameters are tokens of the form <tt>:name</tt> in the
+ * query string. A value is bound to the <tt>integer</tt> parameter
+ * <tt>:foo</tt> by calling<br>
+ * <br>
+ * <tt>setParameter("foo", foo, Hibernate.INTEGER);</tt><br>
+ * <br>
+ * for example. A name may appear multiple times in the query string.<br>
+ * <br>
+ * JDBC-style <tt>?</tt> parameters are also supported. To bind a
+ * value to a JDBC-style parameter use a set method that accepts an
+ * <tt>int</tt> positional argument (numbered from zero, contrary
+ * to JDBC).<br>
+ * <br>
+ * You may not mix and match JDBC-style parameters and named parameters
+ * in the same query.<br>
+ * <br>
+ * Queries are executed by calling <tt>list()</tt>, <tt>scroll()</tt> or
+ * <tt>iterate()</tt>. A query may be re-executed by subsequent invocations.
+ * Its lifespan is, however, bounded by the lifespan of the <tt>Session</tt>
+ * that created it.<br>
+ * <br>
+ * Implementors are not intended to be threadsafe.
+ *
+ * @see org.hibernate.Session#createQuery(java.lang.String)
+ * @see org.hibernate.ScrollableResults
+ * @author Gavin King
+ */
+public interface Query {
+ /**
+ * Get the query string.
+ *
+ * @return the query string
+ */
+ public String getQueryString();
+ /**
+ * Return the Hibernate types of the query result set.
+ * @return an array of types
+ */
+ public Type[] getReturnTypes() throws HibernateException;
+ /**
+ * Return the HQL select clause aliases (if any)
+ * @return an array of aliases as strings
+ */
+ public String[] getReturnAliases() throws HibernateException;
+ /**
+ * Return the names of all named parameters of the query.
+ * @return the parameter names, in no particular order
+ */
+ public String[] getNamedParameters() throws HibernateException;
+ /**
+ * Return the query results as an <tt>Iterator</tt>. If the query
+ * contains multiple results pre row, the results are returned in
+ * an instance of <tt>Object[]</tt>.<br>
+ * <br>
+ * Entities returned as results are initialized on demand. The first
+ * SQL query returns identifiers only.<br>
+ *
+ * @return the result iterator
+ * @throws HibernateException
+ */
+ public Iterator iterate() throws HibernateException;
+ /**
+ * Return the query results as <tt>ScrollableResults</tt>. The
+ * scrollability of the returned results depends upon JDBC driver
+ * support for scrollable <tt>ResultSet</tt>s.<br>
+ *
+ * @see ScrollableResults
+ * @return the result iterator
+ * @throws HibernateException
+ */
+ public ScrollableResults scroll() throws HibernateException;
+ /**
+ * Return the query results as <tt>ScrollableResults</tt>. The
+ * scrollability of the returned results depends upon JDBC driver
+ * support for scrollable <tt>ResultSet</tt>s.<br>
+ *
+ * @see ScrollableResults
+ * @see ScrollMode
+ * @return the result iterator
+ * @throws HibernateException
+ */
+ public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException;
+ /**
+ * Return the query results as a <tt>List</tt>. If the query contains
+ * multiple results pre row, the results are returned in an instance
+ * of <tt>Object[]</tt>.
+ *
+ * @return the result list
+ * @throws HibernateException
+ */
+ public List list() throws HibernateException;
+ /**
+ * Convenience method to return a single instance that matches
+ * the query, or null if the query returns no results.
+ *
+ * @return the single result or <tt>null</tt>
+ * @throws NonUniqueResultException if there is more than one matching result
+ */
+ public Object uniqueResult() throws HibernateException;
+
+ /**
+ * Execute the update or delete statement.
+ * </p>
+ * The semantics are compliant with the ejb3 Query.executeUpdate()
+ * method.
+ *
+ * @return The number of entities updated or deleted.
+ * @throws HibernateException
+ */
+ public int executeUpdate() throws HibernateException;
+
+ /**
+ * Set the maximum number of rows to retrieve. If not set,
+ * there is no limit to the number of rows retrieved.
+ * @param maxResults the maximum number of rows
+ */
+ public Query setMaxResults(int maxResults);
+ /**
+ * Set the first row to retrieve. If not set, rows will be
+ * retrieved beginnning from row <tt>0</tt>.
+ * @param firstResult a row number, numbered from <tt>0</tt>
+ */
+ public Query setFirstResult(int firstResult);
+
+ /**
+ * Entities retrieved by this query will be loaded in
+ * a read-only mode where Hibernate will never dirty-check
+ * them or make changes persistent.
+ *
+ */
+ public Query setReadOnly(boolean readOnly);
+
+ /**
+ * Enable caching of this query result set.
+ * @param cacheable Should the query results be cacheable?
+ */
+ public Query setCacheable(boolean cacheable);
+
+ /**
+ * Set the name of the cache region.
+ * @param cacheRegion the name of a query cache region, or <tt>null</tt>
+ * for the default query cache
+ */
+ public Query setCacheRegion(String cacheRegion);
+
+ /**
+ * Set a timeout for the underlying JDBC query.
+ * @param timeout the timeout in seconds
+ */
+ public Query setTimeout(int timeout);
+ /**
+ * Set a fetch size for the underlying JDBC query.
+ * @param fetchSize the fetch size
+ */
+ public Query setFetchSize(int fetchSize);
+
+ /**
+ * Set the lockmode for the objects idententified by the
+ * given alias that appears in the <tt>FROM</tt> clause.
+ * @param alias a query alias, or <tt>this</tt> for a collection filter
+ */
+ public Query setLockMode(String alias, LockMode lockMode);
+
+ /**
+ * Add a comment to the generated SQL.
+ * @param comment a human-readable string
+ */
+ public Query setComment(String comment);
+
+ /**
+ * Override the current session flush mode, just for
+ * this query.
+ * @see org.hibernate.FlushMode
+ */
+ public Query setFlushMode(FlushMode flushMode);
+
+ /**
+ * Override the current session cache mode, just for
+ * this query.
+ * @see org.hibernate.CacheMode
+ */
+ public Query setCacheMode(CacheMode cacheMode);
+
+ /**
+ * Bind a value to a JDBC-style query parameter.
+ * @param position the position of the parameter in the query
+ * string, numbered from <tt>0</tt>.
+ * @param val the possibly-null parameter value
+ * @param type the Hibernate type
+ */
+ public Query setParameter(int position, Object val, Type type);
+ /**
+ * Bind a value to a named query parameter.
+ * @param name the name of the parameter
+ * @param val the possibly-null parameter value
+ * @param type the Hibernate type
+ */
+ public Query setParameter(String name, Object val, Type type);
+
+ /**
+ * Bind a value to a JDBC-style query parameter. The Hibernate type of the parameter is
+ * first detected via the usage/position in the query and if not sufficient secondly
+ * guessed from the class of the given object.
+ * @param position the position of the parameter in the query
+ * string, numbered from <tt>0</tt>.
+ * @param val the non-null parameter value
+ * @throws org.hibernate.HibernateException if no type could be determined
+ */
+ public Query setParameter(int position, Object val) throws HibernateException;
+ /**
+ * Bind a value to a named query parameter. The Hibernate type of the parameter is
+ * first detected via the usage/position in the query and if not sufficient secondly
+ * guessed from the class of the given object.
+ * @param name the name of the parameter
+ * @param val the non-null parameter value
+ * @throws org.hibernate.HibernateException if no type could be determined
+ */
+ public Query setParameter(String name, Object val) throws HibernateException;
+
+ /**
+ * Bind values and types to positional parameters.
+ */
+ public Query setParameters(Object[] values, Type[] types) throws HibernateException;
+
+ /**
+ * Bind multiple values to a named query parameter. This is useful for binding
+ * a list of values to an expression such as <tt>foo.bar in (:value_list)</tt>.
+ * @param name the name of the parameter
+ * @param vals a collection of values to list
+ * @param type the Hibernate type of the values
+ */
+ public Query setParameterList(String name, Collection vals, Type type) throws HibernateException;
+
+ /**
+ * Bind multiple values to a named query parameter. The Hibernate type of the parameter is
+ * first detected via the usage/position in the query and if not sufficient secondly
+ * guessed from the class of the first object in the collection. This is useful for binding a list of values
+ * to an expression such as <tt>foo.bar in (:value_list)</tt>.
+ * @param name the name of the parameter
+ * @param vals a collection of values to list
+ */
+ public Query setParameterList(String name, Collection vals) throws HibernateException;
+
+ /**
+ * Bind multiple values to a named query parameter. This is useful for binding
+ * a list of values to an expression such as <tt>foo.bar in (:value_list)</tt>.
+ * @param name the name of the parameter
+ * @param vals a collection of values to list
+ * @param type the Hibernate type of the values
+ */
+ public Query setParameterList(String name, Object[] vals, Type type) throws HibernateException;
+
+ /**
+ * Bind multiple values to a named query parameter. The Hibernate type of the parameter is
+ * first detected via the usage/position in the query and if not sufficient secondly
+ * guessed from the class of the first object in the array. This is useful for binding a list of values
+ * to an expression such as <tt>foo.bar in (:value_list)</tt>.
+ * @param name the name of the parameter
+ * @param vals a collection of values to list
+ */
+ public Query setParameterList(String name, Object[] vals) throws HibernateException;
+
+ /**
+ * Bind the property values of the given bean to named parameters of the query,
+ * matching property names with parameter names and mapping property types to
+ * Hibernate types using hueristics.
+ * @param bean any JavaBean or POJO
+ */
+ public Query setProperties(Object bean) throws HibernateException;
+
+ /**
+ * Bind the values of the given Map for each named parameters of the query,
+ * matching key names with parameter names and mapping value types to
+ * Hibernate types using hueristics.
+ * @param bean a java.util.Map
+ */
+ public Query setProperties(Map bean) throws HibernateException;
+
+ public Query setString(int position, String val);
+ public Query setCharacter(int position, char val);
+ public Query setBoolean(int position, boolean val);
+ public Query setByte(int position, byte val);
+ public Query setShort(int position, short val);
+ public Query setInteger(int position, int val);
+ public Query setLong(int position, long val);
+ public Query setFloat(int position, float val);
+ public Query setDouble(int position, double val);
+ public Query setBinary(int position, byte[] val);
+ public Query setText(int position, String val);
+ public Query setSerializable(int position, Serializable val);
+ public Query setLocale(int position, Locale locale);
+ public Query setBigDecimal(int position, BigDecimal number);
+ public Query setBigInteger(int position, BigInteger number);
+
+ public Query setDate(int position, Date date);
+ public Query setTime(int position, Date date);
+ public Query setTimestamp(int position, Date date);
+
+ public Query setCalendar(int position, Calendar calendar);
+ public Query setCalendarDate(int position, Calendar calendar);
+
+ public Query setString(String name, String val);
+ public Query setCharacter(String name, char val);
+ public Query setBoolean(String name, boolean val);
+ public Query setByte(String name, byte val);
+ public Query setShort(String name, short val);
+ public Query setInteger(String name, int val);
+ public Query setLong(String name, long val);
+ public Query setFloat(String name, float val);
+ public Query setDouble(String name, double val);
+ public Query setBinary(String name, byte[] val);
+ public Query setText(String name, String val);
+ public Query setSerializable(String name, Serializable val);
+ public Query setLocale(String name, Locale locale);
+ public Query setBigDecimal(String name, BigDecimal number);
+ public Query setBigInteger(String name, BigInteger number);
+
+ public Query setDate(String name, Date date);
+ public Query setTime(String name, Date date);
+ public Query setTimestamp(String name, Date date);
+
+ public Query setCalendar(String name, Calendar calendar);
+ public Query setCalendarDate(String name, Calendar calendar);
+
+ /**
+ * Bind an instance of a mapped persistent class to a JDBC-style query parameter.
+ * @param position the position of the parameter in the query
+ * string, numbered from <tt>0</tt>.
+ * @param val a non-null instance of a persistent class
+ */
+ public Query setEntity(int position, Object val); // use setParameter for null values
+
+ /**
+ * Bind an instance of a mapped persistent class to a named query parameter.
+ * @param name the name of the parameter
+ * @param val a non-null instance of a persistent class
+ */
+ public Query setEntity(String name, Object val); // use setParameter for null values
+
+
+ /**
+ * Set a strategy for handling the query results. This can be used to change
+ * "shape" of the query result.
+ *
+ * @param transformer The transformer to apply
+ * @return this (for method chaining)
+ */
+ public Query setResultTransformer(ResultTransformer transformer);
+
+}
+
+
+
+
+
+
+
/src/org/hibernate/Query.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/ConnectionReleaseMode.java
===================================================================
--- src/org/hibernate/ConnectionReleaseMode.java (revision 0)
+++ src/org/hibernate/ConnectionReleaseMode.java (revision 33)
@@ -0,0 +1,100 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+/**
+ * Defines the various policies by which Hibernate might release its underlying
+ * JDBC connection.
+ *
+ * @author Steve Ebersole
+ */
+public class ConnectionReleaseMode implements Serializable {
+
+ /**
+ * Indicates that JDBC connection should be aggressively released after each
+ * SQL statement is executed. In this mode, the application <em>must</em>
+ * explicitly close all iterators and scrollable results. This mode may
+ * only be used with a JTA datasource.
+ */
+ public static final ConnectionReleaseMode AFTER_STATEMENT = new ConnectionReleaseMode( "after_statement" );
+
+ /**
+ * Indicates that JDBC connections should be released after each transaction
+ * ends (works with both JTA-registered synch and HibernateTransaction API).
+ * This mode may not be used with an application server JTA datasource.
+ * <p/>
+ * This is the default mode starting in 3.1; was previously {@link #ON_CLOSE}.
+ */
+ public static final ConnectionReleaseMode AFTER_TRANSACTION = new ConnectionReleaseMode( "after_transaction" );
+
+ /**
+ * Indicates that connections should only be released when the Session is explicitly closed
+ * or disconnected; this is the legacy (Hibernate2 and pre-3.1) behavior.
+ */
+ public static final ConnectionReleaseMode ON_CLOSE = new ConnectionReleaseMode( "on_close" );
+
+
+ private String name;
+
+ private ConnectionReleaseMode(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Override of Object.toString(). Returns the release mode name.
+ *
+ * @return The release mode name.
+ */
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * Determine the correct ConnectionReleaseMode instance based on the given
+ * name.
+ *
+ * @param modeName The release mode name.
+ * @return The appropriate ConnectionReleaseMode instance
+ * @throws HibernateException Indicates the modeName param did not match any known modes.
+ */
+ public static ConnectionReleaseMode parse(String modeName) throws HibernateException {
+ if ( AFTER_STATEMENT.name.equals( modeName ) ) {
+ return AFTER_STATEMENT;
+ }
+ else if ( AFTER_TRANSACTION.name.equals( modeName ) ) {
+ return AFTER_TRANSACTION;
+ }
+ else if ( ON_CLOSE.name.equals( modeName ) ) {
+ return ON_CLOSE;
+ }
+ throw new HibernateException( "could not determine appropriate connection release mode [" + modeName + "]" );
+ }
+
+ private Object readResolve() {
+ return parse( name );
+ }
+}
/src/org/hibernate/ConnectionReleaseMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/DuplicateMappingException.java
===================================================================
--- src/org/hibernate/DuplicateMappingException.java (revision 0)
+++ src/org/hibernate/DuplicateMappingException.java (revision 33)
@@ -0,0 +1,56 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Raised whenever a duplicate for a certain type occurs.
+ * Duplicate class, table, property name etc.
+ *
+ * @author Max Rydahl Andersen
+ *
+ */
+public class DuplicateMappingException extends MappingException {
+
+ private final String name;
+ private final String type;
+
+ public DuplicateMappingException(String customMessage, String type, String name) {
+ super(customMessage);
+ this.type=type;
+ this.name=name;
+ }
+
+ public DuplicateMappingException(String type, String name) {
+ this("Duplicate " + type + " mapping " + name, type, name);
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
/src/org/hibernate/DuplicateMappingException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/PersistentObjectException.java
===================================================================
--- src/org/hibernate/PersistentObjectException.java (revision 0)
+++ src/org/hibernate/PersistentObjectException.java (revision 33)
@@ -0,0 +1,38 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown when the user passes a persistent instance to a <tt>Session</tt>
+ * method that expects a transient instance.
+ *
+ * @author Gavin King
+ */
+public class PersistentObjectException extends HibernateException {
+
+ public PersistentObjectException(String s) {
+ super(s);
+ }
+}
/src/org/hibernate/PersistentObjectException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/LazyInitializationException.java
===================================================================
--- src/org/hibernate/LazyInitializationException.java (revision 0)
+++ src/org/hibernate/LazyInitializationException.java (revision 33)
@@ -0,0 +1,51 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import org.slf4j.LoggerFactory;
+
+/**
+ * Indicates access to unfetched data outside of a session context.
+ * For example, when an uninitialized proxy or collection is accessed
+ * after the session was closed.
+ *
+ * @see Hibernate#initialize(java.lang.Object)
+ * @see Hibernate#isInitialized(java.lang.Object)
+ * @author Gavin King
+ */
+public class LazyInitializationException extends HibernateException {
+
+ public LazyInitializationException(String msg) {
+ super(msg);
+ LoggerFactory.getLogger( LazyInitializationException.class ).error( msg, this );
+ }
+
+}
+
+
+
+
+
+
/src/org/hibernate/LazyInitializationException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/UnresolvableObjectException.java
===================================================================
--- src/org/hibernate/UnresolvableObjectException.java (revision 0)
+++ src/org/hibernate/UnresolvableObjectException.java (revision 33)
@@ -0,0 +1,75 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+import org.hibernate.pretty.MessageHelper;
+
+/**
+ * Thrown when Hibernate could not resolve an object by id, especially when
+ * loading an association.
+ *
+ * @author Gavin King
+ */
+public class UnresolvableObjectException extends HibernateException {
+
+ private final Serializable identifier;
+ private final String entityName;
+
+ public UnresolvableObjectException(Serializable identifier, String clazz) {
+ this("No row with the given identifier exists", identifier, clazz);
+ }
+ UnresolvableObjectException(String message, Serializable identifier, String clazz) {
+ super(message);
+ this.identifier = identifier;
+ this.entityName = clazz;
+ }
+ public Serializable getIdentifier() {
+ return identifier;
+ }
+
+ public String getMessage() {
+ return super.getMessage() + ": " +
+ MessageHelper.infoString(entityName, identifier);
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+ public static void throwIfNull(Object o, Serializable id, String clazz)
+ throws UnresolvableObjectException {
+ if (o==null) throw new UnresolvableObjectException(id, clazz);
+ }
+
+}
+
+
+
+
+
+
+
/src/org/hibernate/UnresolvableObjectException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/CacheMode.java
===================================================================
--- src/org/hibernate/CacheMode.java (revision 0)
+++ src/org/hibernate/CacheMode.java (revision 33)
@@ -0,0 +1,101 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Controls how the session interacts with the second-level
+ * cache and query cache.
+ *
+ * @see Session#setCacheMode(CacheMode)
+ * @author Gavin King
+ */
+public final class CacheMode implements Serializable {
+ private final String name;
+ private final boolean isPutEnabled;
+ private final boolean isGetEnabled;
+ private static final Map INSTANCES = new HashMap();
+
+ private CacheMode(String name, boolean isPutEnabled, boolean isGetEnabled) {
+ this.name=name;
+ this.isPutEnabled = isPutEnabled;
+ this.isGetEnabled = isGetEnabled;
+ }
+ public String toString() {
+ return name;
+ }
+ public boolean isPutEnabled() {
+ return isPutEnabled;
+ }
+ public boolean isGetEnabled() {
+ return isGetEnabled;
+ }
+ /**
+ * The session may read items from the cache, and add items to the cache
+ */
+ public static final CacheMode NORMAL = new CacheMode("NORMAL", true, true);
+ /**
+ * The session will never interact with the cache, except to invalidate
+ * cache items when updates occur
+ */
+ public static final CacheMode IGNORE = new CacheMode("IGNORE", false, false);
+ /**
+ * The session may read items from the cache, but will not add items,
+ * except to invalidate items when updates occur
+ */
+ public static final CacheMode GET = new CacheMode("GET", false, true);
+ /**
+ * The session will never read items from the cache, but will add items
+ * to the cache as it reads them from the database.
+ */
+ public static final CacheMode PUT = new CacheMode("PUT", true, false);
+
+ /**
+ * The session will never read items from the cache, but will add items
+ * to the cache as it reads them from the database. In this mode, the
+ * effect of <tt>hibernate.cache.use_minimal_puts</tt> is bypassed, in
+ * order to <em>force</em> a cache refresh
+ */
+ public static final CacheMode REFRESH = new CacheMode("REFRESH", true, false);
+
+ static {
+ INSTANCES.put( NORMAL.name, NORMAL );
+ INSTANCES.put( IGNORE.name, IGNORE );
+ INSTANCES.put( GET.name, GET );
+ INSTANCES.put( PUT.name, PUT );
+ INSTANCES.put( REFRESH.name, REFRESH );
+ }
+
+ private Object readResolve() {
+ return INSTANCES.get( name );
+ }
+
+ public static CacheMode parse(String name) {
+ return ( CacheMode ) INSTANCES.get( name );
+ }
+}
/src/org/hibernate/CacheMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/MappingException.java
===================================================================
--- src/org/hibernate/MappingException.java (revision 0)
+++ src/org/hibernate/MappingException.java (revision 33)
@@ -0,0 +1,54 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * An exception that usually occurs at configuration time, rather
+ * than runtime, as a result of something screwy in the O-R mappings.
+ *
+ * @author Gavin King
+ */
+
+public class MappingException extends HibernateException {
+
+ public MappingException(String msg, Throwable root) {
+ super( msg, root );
+ }
+
+ public MappingException(Throwable root) {
+ super(root);
+ }
+
+ public MappingException(String s) {
+ super(s);
+ }
+
+}
+
+
+
+
+
+
/src/org/hibernate/MappingException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/SessionFactory.java
===================================================================
--- src/org/hibernate/SessionFactory.java (revision 0)
+++ src/org/hibernate/SessionFactory.java (revision 33)
@@ -0,0 +1,247 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.Referenceable;
+
+import org.hibernate.metadata.ClassMetadata;
+import org.hibernate.metadata.CollectionMetadata;
+import org.hibernate.stat.Statistics;
+import org.hibernate.engine.FilterDefinition;
+
+/**
+ * Creates <tt>Session</tt>s. Usually an application has a single <tt>SessionFactory</tt>.
+ * Threads servicing client requests obtain <tt>Session</tt>s from the factory.<br>
+ * <br>
+ * Implementors must be threadsafe.<br>
+ * <br>
+ * <tt>SessionFactory</tt>s are immutable. The behaviour of a <tt>SessionFactory</tt> is
+ * controlled by properties supplied at configuration time. These properties are defined
+ * on <tt>Environment</tt>.
+ *
+ * @see Session
+ * @see org.hibernate.cfg.Environment
+ * @see org.hibernate.cfg.Configuration
+ * @see org.hibernate.connection.ConnectionProvider
+ * @see org.hibernate.transaction.TransactionFactory
+ * @author Gavin King
+ */
+public interface SessionFactory extends Referenceable, Serializable {
+
+ /**
+ * Open a <tt>Session</tt> on the given connection.
+ * <p>
+ * Note that the second-level cache will be disabled if you
+ * supply a JDBC connection. Hibernate will not be able to track
+ * any statements you might have executed in the same transaction.
+ * Consider implementing your own <tt>ConnectionProvider</tt>.
+ *
+ * @param connection a connection provided by the application.
+ * @return Session
+ */
+ public org.hibernate.classic.Session openSession(Connection connection);
+
+ /**
+ * Create database connection and open a <tt>Session</tt> on it, specifying an
+ * interceptor.
+ *
+ * @param interceptor a session-scoped interceptor
+ * @return Session
+ * @throws HibernateException
+ */
+ public org.hibernate.classic.Session openSession(Interceptor interceptor) throws HibernateException;
+
+ /**
+ * Open a <tt>Session</tt> on the given connection, specifying an interceptor.
+ * <p>
+ * Note that the second-level cache will be disabled if you
+ * supply a JDBC connection. Hibernate will not be able to track
+ * any statements you might have executed in the same transaction.
+ * Consider implementing your own <tt>ConnectionProvider</tt>.
+ *
+ * @param connection a connection provided by the application.
+ * @param interceptor a session-scoped interceptor
+ * @return Session
+ */
+ public org.hibernate.classic.Session openSession(Connection connection, Interceptor interceptor);
+
+ /**
+ * Create database connection and open a <tt>Session</tt> on it.
+ *
+ * @return Session
+ * @throws HibernateException
+ */
+ public org.hibernate.classic.Session openSession() throws HibernateException;
+
+ /**
+ * Obtains the current session. The definition of what exactly "current"
+ * means controlled by the {@link org.hibernate.context.CurrentSessionContext} impl configured
+ * for use.
+ * <p/>
+ * Note that for backwards compatibility, if a {@link org.hibernate.context.CurrentSessionContext}
+ * is not configured but a JTA {@link org.hibernate.transaction.TransactionManagerLookup}
+ * is configured this will default to the {@link org.hibernate.context.JTASessionContext}
+ * impl.
+ *
+ * @return The current session.
+ * @throws HibernateException Indicates an issue locating a suitable current session.
+ */
+ public org.hibernate.classic.Session getCurrentSession() throws HibernateException;
+
+ /**
+ * Get the <tt>ClassMetadata</tt> associated with the given entity class
+ *
+ * @see org.hibernate.metadata.ClassMetadata
+ */
+ public ClassMetadata getClassMetadata(Class persistentClass) throws HibernateException;
+
+ /**
+ * Get the <tt>ClassMetadata</tt> associated with the given entity name
+ *
+ * @see org.hibernate.metadata.ClassMetadata
+ * @since 3.0
+ */
+ public ClassMetadata getClassMetadata(String entityName) throws HibernateException;
+
+ /**
+ * Get the <tt>CollectionMetadata</tt> associated with the named collection role
+ *
+ * @see org.hibernate.metadata.CollectionMetadata
+ */
+ public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException;
+
+
+ /**
+ * Get all <tt>ClassMetadata</tt> as a <tt>Map</tt> from entityname <tt>String</tt>
+ * to metadata object
+ *
+ * @see org.hibernate.metadata.ClassMetadata
+ * @return a map from <tt>String</tt> an entity name to <tt>ClassMetaData</tt>
+ * @since 3.0 changed key from <tt>Class</tt> to <tt>String</tt>
+ */
+ public Map getAllClassMetadata() throws HibernateException;
+
+ /**
+ * Get all <tt>CollectionMetadata</tt> as a <tt>Map</tt> from role name
+ * to metadata object
+ *
+ * @see org.hibernate.metadata.CollectionMetadata
+ * @return a map from <tt>String</tt> to <tt>CollectionMetadata</tt>
+ */
+ public Map getAllCollectionMetadata() throws HibernateException;
+
+ /**
+ * Get the statistics for this session factory
+ */
+ public Statistics getStatistics();
+
+ /**
+ * Destroy this <tt>SessionFactory</tt> and release all resources (caches,
+ * connection pools, etc). It is the responsibility of the application
+ * to ensure that there are no open <tt>Session</tt>s before calling
+ * <tt>close()</tt>.
+ */
+ public void close() throws HibernateException;
+
+ /**
+ * Was this <tt>SessionFactory</tt> already closed?
+ */
+ public boolean isClosed();
+
+ /**
+ * Evict all entries from the second-level cache. This method occurs outside
+ * of any transaction; it performs an immediate "hard" remove, so does not respect
+ * any transaction isolation semantics of the usage strategy. Use with care.
+ */
+ public void evict(Class persistentClass) throws HibernateException;
+ /**
+ * Evict an entry from the second-level cache. This method occurs outside
+ * of any transaction; it performs an immediate "hard" remove, so does not respect
+ * any transaction isolation semantics of the usage strategy. Use with care.
+ */
+ public void evict(Class persistentClass, Serializable id) throws HibernateException;
+ /**
+ * Evict all entries from the second-level cache. This method occurs outside
+ * of any transaction; it performs an immediate "hard" remove, so does not respect
+ * any transaction isolation semantics of the usage strategy. Use with care.
+ */
+ public void evictEntity(String entityName) throws HibernateException;
+ /**
+ * Evict an entry from the second-level cache. This method occurs outside
+ * of any transaction; it performs an immediate "hard" remove, so does not respect
+ * any transaction isolation semantics of the usage strategy. Use with care.
+ */
+ public void evictEntity(String entityName, Serializable id) throws HibernateException;
+ /**
+ * Evict all entries from the second-level cache. This method occurs outside
+ * of any transaction; it performs an immediate "hard" remove, so does not respect
+ * any transaction isolation semantics of the usage strategy. Use with care.
+ */
+ public void evictCollection(String roleName) throws HibernateException;
+ /**
+ * Evict an entry from the second-level cache. This method occurs outside
+ * of any transaction; it performs an immediate "hard" remove, so does not respect
+ * any transaction isolation semantics of the usage strategy. Use with care.
+ */
+ public void evictCollection(String roleName, Serializable id) throws HibernateException;
+
+ /**
+ * Evict any query result sets cached in the default query cache region.
+ */
+ public void evictQueries() throws HibernateException;
+ /**
+ * Evict any query result sets cached in the named query cache region.
+ */
+ public void evictQueries(String cacheRegion) throws HibernateException;
+ /**
+ * Get a new stateless session.
+ */
+ public StatelessSession openStatelessSession();
+ /**
+ * Get a new stateless session for the given JDBC connection.
+ */
+ public StatelessSession openStatelessSession(Connection connection);
+
+ /**
+ * Obtain a set of the names of all filters defined on this SessionFactory.
+ *
+ * @return The set of filter names.
+ */
+ public Set getDefinedFilterNames();
+
+ /**
+ * Obtain the definition of a filter by name.
+ *
+ * @param filterName The name of the filter for which to obtain the definition.
+ * @return The filter definition.
+ * @throws HibernateException If no filter defined with the given name.
+ */
+ public FilterDefinition getFilterDefinition(String filterName) throws HibernateException;
+}
/src/org/hibernate/SessionFactory.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/EmptyInterceptor.java
===================================================================
--- src/org/hibernate/EmptyInterceptor.java (revision 0)
+++ src/org/hibernate/EmptyInterceptor.java (revision 33)
@@ -0,0 +1,121 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+import org.hibernate.type.Type;
+
+/**
+ * An interceptor that does nothing. May be used as a base class
+ * for application-defined custom interceptors.
+ *
+ * @author Gavin King
+ */
+public class EmptyInterceptor implements Interceptor, Serializable {
+
+ public static final Interceptor INSTANCE = new EmptyInterceptor();
+
+ protected EmptyInterceptor() {}
+
+ public void onDelete(
+ Object entity,
+ Serializable id,
+ Object[] state,
+ String[] propertyNames,
+ Type[] types) {}
+
+ public boolean onFlushDirty(
+ Object entity,
+ Serializable id,
+ Object[] currentState,
+ Object[] previousState,
+ String[] propertyNames,
+ Type[] types) {
+ return false;
+ }
+
+ public boolean onLoad(
+ Object entity,
+ Serializable id,
+ Object[] state,
+ String[] propertyNames,
+ Type[] types) {
+ return false;
+ }
+
+ public boolean onSave(
+ Object entity,
+ Serializable id,
+ Object[] state,
+ String[] propertyNames,
+ Type[] types) {
+ return false;
+ }
+
+ public void postFlush(Iterator entities) {}
+ public void preFlush(Iterator entities) {}
+
+ public Boolean isTransient(Object entity) {
+ return null;
+ }
+
+ public Object instantiate(String entityName, EntityMode entityMode, Serializable id) {
+ return null;
+ }
+
+ public int[] findDirty(Object entity,
+ Serializable id,
+ Object[] currentState,
+ Object[] previousState,
+ String[] propertyNames,
+ Type[] types) {
+ return null;
+ }
+
+ public String getEntityName(Object object) {
+ return null;
+ }
+
+ public Object getEntity(String entityName, Serializable id) {
+ return null;
+ }
+
+ public void afterTransactionBegin(Transaction tx) {}
+ public void afterTransactionCompletion(Transaction tx) {}
+ public void beforeTransactionCompletion(Transaction tx) {}
+
+ public String onPrepareStatement(String sql) {
+ return sql;
+ }
+
+ public void onCollectionRemove(Object collection, Serializable key) throws CallbackException {}
+
+ public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException {}
+
+ public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException {}
+
+}
\ No newline at end of file
/src/org/hibernate/EmptyInterceptor.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/TransientObjectException.java
===================================================================
--- src/org/hibernate/TransientObjectException.java (revision 0)
+++ src/org/hibernate/TransientObjectException.java (revision 33)
@@ -0,0 +1,40 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown when the user passes a transient instance to a <tt>Session</tt>
+ * method that expects a persistent instance.
+ *
+ * @author Gavin King
+ */
+
+public class TransientObjectException extends HibernateException {
+
+ public TransientObjectException(String s) {
+ super(s);
+ }
+
+}
/src/org/hibernate/TransientObjectException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Columns.java
===================================================================
--- src/org/hibernate/annotations/Columns.java (revision 0)
+++ src/org/hibernate/annotations/Columns.java (revision 33)
@@ -0,0 +1,20 @@
+//$Id: Columns.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.persistence.Column;
+
+/**
+ * Support an array of columns. Useful for component user types mappings
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Columns {
+ Column[] columns();
+}
/src/org/hibernate/annotations/Columns.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/NamedNativeQuery.java
===================================================================
--- src/org/hibernate/annotations/NamedNativeQuery.java (revision 0)
+++ src/org/hibernate/annotations/NamedNativeQuery.java (revision 33)
@@ -0,0 +1,42 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Extends {@link javax.persistence.NamedNativeQuery} with Hibernate features
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, PACKAGE})
+@Retention(RUNTIME)
+public @interface NamedNativeQuery {
+ String name();
+
+ String query();
+
+ Class resultClass() default void.class;
+
+ String resultSetMapping() default ""; // name of SQLResultSetMapping
+ /** the flush mode for the query */
+ FlushModeType flushMode() default FlushModeType.PERSISTENCE_CONTEXT;
+ /** mark the query as cacheable or not */
+ boolean cacheable() default false;
+ /** the cache region to use */
+ String cacheRegion() default "";
+ /** the number of rows fetched by the JDBC Driver per roundtrip */
+ int fetchSize() default -1;
+ /**the query timeout in seconds*/
+ int timeout() default -1;
+
+ boolean callable() default false;
+ /**comment added to the SQL query, useful for the DBA */
+ String comment() default "";
+ /**the cache mode used for this query*/
+ CacheModeType cacheMode() default CacheModeType.NORMAL;
+ /**marks whether the results are fetched in read-only mode or not*/
+ boolean readOnly() default false;
+}
/src/org/hibernate/annotations/NamedNativeQuery.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/NamedQueries.java
===================================================================
--- src/org/hibernate/annotations/NamedQueries.java (revision 0)
+++ src/org/hibernate/annotations/NamedQueries.java (revision 33)
@@ -0,0 +1,20 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Extends {@link javax.persistence.NamedQueries} to hold hibernate NamedQuery
+ * objects
+ *
+ * @author Emmanuel Bernard
+ * @author Carlos González-Cadenas
+ */
+@Target({TYPE, PACKAGE})
+@Retention(RUNTIME)
+public @interface NamedQueries {
+ NamedQuery[] value();
+}
\ No newline at end of file
/src/org/hibernate/annotations/NamedQueries.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/MetaValue.java
===================================================================
--- src/org/hibernate/annotations/MetaValue.java (revision 0)
+++ src/org/hibernate/annotations/MetaValue.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id$
+package org.hibernate.annotations;
+
+/**
+ * Represent a discriminator value associated to a given entity type
+ * @author Emmanuel Bernard
+ */
+public @interface MetaValue {
+ /**
+ * entity type
+ */
+ Class targetEntity();
+
+ /**
+ * discriminator value stored in database
+ */
+ String value();
+}
/src/org/hibernate/annotations/MetaValue.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/NaturalId.java
===================================================================
--- src/org/hibernate/annotations/NaturalId.java (revision 0)
+++ src/org/hibernate/annotations/NaturalId.java (revision 33)
@@ -0,0 +1,22 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+
+/**
+ * This specifies that a property is part of the natural id of the entity.
+ *
+ * @author Nicol‡s Lichtmaier
+ */
+@Target( { METHOD, FIELD } )
+@Retention( RUNTIME )
+public @interface NaturalId {
+ /**
+ * If this natural id component is mutable or not.
+ */
+ boolean mutable() default false;
+}
/src/org/hibernate/annotations/NaturalId.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/CascadeType.java
===================================================================
--- src/org/hibernate/annotations/CascadeType.java (revision 0)
+++ src/org/hibernate/annotations/CascadeType.java (revision 33)
@@ -0,0 +1,18 @@
+package org.hibernate.annotations;
+
+/**
+ * Cascade types (can override default EJB3 cascades
+ */
+public enum CascadeType {
+ ALL,
+ PERSIST,
+ MERGE,
+ REMOVE,
+ REFRESH,
+ DELETE,
+ SAVE_UPDATE,
+ REPLICATE,
+ DELETE_ORPHAN,
+ LOCK,
+ EVICT
+}
/src/org/hibernate/annotations/CascadeType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Sort.java
===================================================================
--- src/org/hibernate/annotations/Sort.java (revision 0)
+++ src/org/hibernate/annotations/Sort.java (revision 33)
@@ -0,0 +1,29 @@
+//$Id: Sort.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Collection sort
+ * (Java level sorting)
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Sort {
+ /**
+ * sort type
+ */
+ SortType type() default SortType.UNSORTED;
+ /**
+ * Sort comparator implementation
+ */
+ //TODO find a way to use Class<Comparator>
+
+ Class comparator() default void.class;
+}
/src/org/hibernate/annotations/Sort.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/FilterDefs.java
===================================================================
--- src/org/hibernate/annotations/FilterDefs.java (revision 0)
+++ src/org/hibernate/annotations/FilterDefs.java (revision 33)
@@ -0,0 +1,20 @@
+//$Id: FilterDefs.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Array of filter definitions
+ *
+ * @author Matthew Inger
+ * @author Emmanuel Bernard
+ */
+@Target({PACKAGE, TYPE})
+@Retention(RUNTIME)
+public @interface FilterDefs {
+ FilterDef[] value();
+}
/src/org/hibernate/annotations/FilterDefs.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/LazyCollection.java
===================================================================
--- src/org/hibernate/annotations/LazyCollection.java (revision 0)
+++ src/org/hibernate/annotations/LazyCollection.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Define the lazy status of a collection
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LazyCollection {
+ LazyCollectionOption value();
+}
/src/org/hibernate/annotations/LazyCollection.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/OnDeleteAction.java
===================================================================
--- src/org/hibernate/annotations/OnDeleteAction.java (revision 0)
+++ src/org/hibernate/annotations/OnDeleteAction.java (revision 33)
@@ -0,0 +1,17 @@
+package org.hibernate.annotations;
+
+/**
+ * Possible actions on deletes
+ *
+ * @author Emmanuel Bernard
+ */
+public enum OnDeleteAction {
+ /**
+ * the default
+ */
+ NO_ACTION,
+ /**
+ * use cascade delete capabilities of the DD
+ */
+ CASCADE
+}
/src/org/hibernate/annotations/OnDeleteAction.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/FilterJoinTables.java
===================================================================
--- src/org/hibernate/annotations/FilterJoinTables.java (revision 0)
+++ src/org/hibernate/annotations/FilterJoinTables.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Add multiple @FilterJoinTable to a collection
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface FilterJoinTables {
+ FilterJoinTable[] value();
+}
/src/org/hibernate/annotations/FilterJoinTables.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/ForeignKey.java
===================================================================
--- src/org/hibernate/annotations/ForeignKey.java (revision 0)
+++ src/org/hibernate/annotations/ForeignKey.java (revision 33)
@@ -0,0 +1,29 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD, TYPE})
+@Retention(RUNTIME)
+
+/**
+ * Define the foreign key name
+ */
+public @interface ForeignKey {
+ /**
+ * Name of the foreign key. Used in OneToMany, ManyToOne, and OneToOne
+ * relationships. Used for the owning side in ManyToMany relationships
+ */
+ String name();
+
+ /**
+ * Used for the non-owning side of a ManyToMany relationship. Ignored
+ * in other relationships
+ */
+ String inverseName() default "";
+}
\ No newline at end of file
/src/org/hibernate/annotations/ForeignKey.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/PolymorphismType.java
===================================================================
--- src/org/hibernate/annotations/PolymorphismType.java (revision 0)
+++ src/org/hibernate/annotations/PolymorphismType.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: PolymorphismType.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+/**
+ * Type of avaliable polymorphism for a particular entity
+ *
+ * @author Emmanuel Bernard
+ */
+public enum PolymorphismType {
+ /**
+ * default, this entity is retrieved if any of its super entity is asked
+ */
+ IMPLICIT,
+ /**
+ * this entity is retrived only if explicitly asked
+ */
+ EXPLICIT
+}
\ No newline at end of file
/src/org/hibernate/annotations/PolymorphismType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Formula.java
===================================================================
--- src/org/hibernate/annotations/Formula.java (revision 0)
+++ src/org/hibernate/annotations/Formula.java (revision 33)
@@ -0,0 +1,19 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Formula. To be used as a replacement for @Column in most places
+ * The formula has to be a valid SQL fragment
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Formula {
+ String value();
+}
/src/org/hibernate/annotations/Formula.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Filters.java
===================================================================
--- src/org/hibernate/annotations/Filters.java (revision 0)
+++ src/org/hibernate/annotations/Filters.java (revision 33)
@@ -0,0 +1,20 @@
+//$Id: Filters.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Add multiple @Filters
+ *
+ * @author Emmanuel Bernard
+ * @author Matthew Inger
+ * @author Magnus Sandberg
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Filters {
+ Filter[] value();
+}
/src/org/hibernate/annotations/Filters.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/SQLDeleteAll.java
===================================================================
--- src/org/hibernate/annotations/SQLDeleteAll.java (revision 0)
+++ src/org/hibernate/annotations/SQLDeleteAll.java (revision 33)
@@ -0,0 +1,34 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * SqlDelete Annotation for overwriting Hibernate default DELETE ALL method
+ *
+ * @author László Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RetentionPolicy.RUNTIME )
+public @interface SQLDeleteAll {
+ /**
+ * Procedure name or DELETE STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
/src/org/hibernate/annotations/SQLDeleteAll.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/LazyToOneOption.java
===================================================================
--- src/org/hibernate/annotations/LazyToOneOption.java (revision 0)
+++ src/org/hibernate/annotations/LazyToOneOption.java (revision 33)
@@ -0,0 +1,23 @@
+//$Id: $
+package org.hibernate.annotations;
+
+/**
+ * Lazy options available for a ToOne association
+ *
+ * @author Emmanuel Bernard
+ */
+public enum LazyToOneOption {
+ /** eagerly load the association */
+ FALSE,
+ /**
+ * Lazy, give back a proxy which will be loaded when the state is requested
+ * This should be the prefered option
+ */
+ PROXY,
+ /** Lazy, give back the real object loaded when a reference is requested
+ * (Bytecode enhancement is mandatory for this option, fall back to PROXY
+ * if the class is not enhanced)
+ * This option should be avoided unless you can't afford the use of proxies
+ */
+ NO_PROXY
+}
/src/org/hibernate/annotations/LazyToOneOption.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/AnyMetaDef.java
===================================================================
--- src/org/hibernate/annotations/AnyMetaDef.java (revision 0)
+++ src/org/hibernate/annotations/AnyMetaDef.java (revision 33)
@@ -0,0 +1,40 @@
+//$Id$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Defines @Any and @manyToAny metadata
+ *
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target( { PACKAGE, TYPE, METHOD, FIELD } )
+@Retention( RUNTIME )
+public @interface AnyMetaDef {
+ /**
+ * If defined, assign a global meta definition name to be used in an @Any or @ManyToAny annotation
+ * If not defined, the metadata applies to the current property or field
+ */
+ String name() default "";
+
+ /**
+ * meta discriminator Hibernate type
+ */
+ String metaType();
+
+ /**
+ * Hibernate type of the id column
+ * @return
+ */
+ String idType();
+
+ /**
+ * Matching discriminator values with their respective entity
+ */
+ MetaValue[] metaValues();
+}
/src/org/hibernate/annotations/AnyMetaDef.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/ManyToAny.java
===================================================================
--- src/org/hibernate/annotations/ManyToAny.java (revision 0)
+++ src/org/hibernate/annotations/ManyToAny.java (revision 33)
@@ -0,0 +1,41 @@
+//$Id$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import javax.persistence.Column;
+import javax.persistence.FetchType;
+import static javax.persistence.FetchType.EAGER;
+
+/**
+ * Defined a ToMany association pointing to different entity types.
+ * Matching the according entity type is doe through a metadata discriminator column
+ * This kind of mapping should be only marginal.
+ *
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface ManyToAny {
+ /**
+ * Metadata definition used.
+ * If defined, should point to a @AnyMetaDef name
+ * If not defined, the local (ie in the same field or property) @AnyMetaDef is used
+ */
+ String metaDef() default "";
+
+ /**
+ * Metadata dicriminator column description, This column will hold the meta value corresponding to the
+ * targeted entity.
+ */
+ Column metaColumn();
+ /**
+ * Defines whether the value of the field or property should be lazily loaded or must be
+ * eagerly fetched. The EAGER strategy is a requirement on the persistence provider runtime
+ * that the value must be eagerly fetched. The LAZY strategy is applied when bytecode
+ * enhancement is used. If not specified, defaults to EAGER.
+ */
+ FetchType fetch() default EAGER;
+}
/src/org/hibernate/annotations/ManyToAny.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/TypeDefs.java
===================================================================
--- src/org/hibernate/annotations/TypeDefs.java (revision 0)
+++ src/org/hibernate/annotations/TypeDefs.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: TypeDefs.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Type definition array
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, PACKAGE})
+@Retention(RUNTIME)
+public @interface TypeDefs {
+ TypeDef[] value();
+}
/src/org/hibernate/annotations/TypeDefs.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/LazyCollectionOption.java
===================================================================
--- src/org/hibernate/annotations/LazyCollectionOption.java (revision 0)
+++ src/org/hibernate/annotations/LazyCollectionOption.java (revision 33)
@@ -0,0 +1,16 @@
+//$Id: $
+package org.hibernate.annotations;
+
+/**
+ * Lazy options available for a collection
+ *
+ * @author Emmanuel Bernard
+ */
+public enum LazyCollectionOption {
+ /** eagerly load it */
+ FALSE,
+ /** load it when the state is requested */
+ TRUE,
+ /** prefer extra queries over fill collection loading */
+ EXTRA
+}
/src/org/hibernate/annotations/LazyCollectionOption.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/SQLInsert.java
===================================================================
--- src/org/hibernate/annotations/SQLInsert.java (revision 0)
+++ src/org/hibernate/annotations/SQLInsert.java (revision 33)
@@ -0,0 +1,33 @@
+//$Id:$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * SqlInsert Annotation for overwriting Hibernate default INSERT INTO method
+ *
+ * @author László Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface SQLInsert {
+ /**
+ * Procedure name or INSERT STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
/src/org/hibernate/annotations/SQLInsert.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Target.java
===================================================================
--- src/org/hibernate/annotations/Target.java (revision 0)
+++ src/org/hibernate/annotations/Target.java (revision 33)
@@ -0,0 +1,17 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Define an explicit target,a voiding reflection and generics resolving
+ *
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target({ElementType.FIELD, ElementType.METHOD})
+@Retention( RetentionPolicy.RUNTIME )
+public @interface Target {
+ Class value();
+}
/src/org/hibernate/annotations/Target.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Any.java
===================================================================
--- src/org/hibernate/annotations/Any.java (revision 0)
+++ src/org/hibernate/annotations/Any.java (revision 33)
@@ -0,0 +1,45 @@
+//$Id$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import javax.persistence.Column;
+import javax.persistence.FetchType;
+import static javax.persistence.FetchType.EAGER;
+
+/**
+ * Define a ToOne association pointing to several entity types.
+ * Matching the according entity type is doe through a metadata discriminator column
+ * This kind of mapping should be only marginal.
+ *
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Any {
+ /**
+ * Metadata definition used.
+ * If defined, should point to a @AnyMetaDef name
+ * If not defined, the local (ie in the same field or property) @AnyMetaDef is used
+ */
+ String metaDef() default "";
+
+ /**
+ * Metadata discriminator column description, This column will hold the meta value corresponding to the
+ * targeted entity.
+ */
+ Column metaColumn();
+ /**
+ * Defines whether the value of the field or property should be lazily loaded or must be
+ * eagerly fetched. The EAGER strategy is a requirement on the persistence provider runtime
+ * that the value must be eagerly fetched. The LAZY strategy is applied when bytecode
+ * enhancement is used. If not specified, defaults to EAGER.
+ */
+ FetchType fetch() default EAGER;
+ /**
+ * Whether the association is optional. If set to false then a non-null relationship must always exist.
+ */
+ boolean optional() default true;
+}
/src/org/hibernate/annotations/Any.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Parent.java
===================================================================
--- src/org/hibernate/annotations/Parent.java (revision 0)
+++ src/org/hibernate/annotations/Parent.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Reference the property as a pointer back to the owner (generally the owning entity)
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Parent {
+}
/src/org/hibernate/annotations/Parent.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/SortType.java
===================================================================
--- src/org/hibernate/annotations/SortType.java (revision 0)
+++ src/org/hibernate/annotations/SortType.java (revision 33)
@@ -0,0 +1,13 @@
+//$Id: SortType.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+/**
+ * Sort strategies
+ *
+ * @author Emmanuel Bernard
+ */
+public enum SortType {
+ UNSORTED,
+ NATURAL,
+ COMPARATOR
+}
/src/org/hibernate/annotations/SortType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/NotFound.java
===================================================================
--- src/org/hibernate/annotations/NotFound.java (revision 0)
+++ src/org/hibernate/annotations/NotFound.java (revision 33)
@@ -0,0 +1,18 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Action to do when an element is not found on a association whiel beeing expected
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface NotFound {
+ NotFoundAction action() default NotFoundAction.EXCEPTION;
+}
/src/org/hibernate/annotations/NotFound.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/DiscriminatorFormula.java
===================================================================
--- src/org/hibernate/annotations/DiscriminatorFormula.java (revision 0)
+++ src/org/hibernate/annotations/DiscriminatorFormula.java (revision 33)
@@ -0,0 +1,20 @@
+//$Id: DiscriminatorFormula.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Discriminator formula
+ * To be placed at the root entity.
+ *
+ * @author Emmanuel Bernard
+ * @see Formula
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface DiscriminatorFormula {
+ String value();
+}
/src/org/hibernate/annotations/DiscriminatorFormula.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/FetchMode.java
===================================================================
--- src/org/hibernate/annotations/FetchMode.java (revision 0)
+++ src/org/hibernate/annotations/FetchMode.java (revision 33)
@@ -0,0 +1,22 @@
+//$Id: $
+package org.hibernate.annotations;
+
+/**
+ * Fetch options on associations
+ *
+ * @author Emmanuel Bernard
+ */
+public enum FetchMode {
+ /**
+ * use a select for each individual entity, collection, or join load
+ */
+ SELECT,
+ /**
+ * use an outer join to load the related entities, collections or joins
+ */
+ JOIN,
+ /**
+ * use a subselect query to load the additional collections
+ */
+ SUBSELECT
+}
/src/org/hibernate/annotations/FetchMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/OnDelete.java
===================================================================
--- src/org/hibernate/annotations/OnDelete.java (revision 0)
+++ src/org/hibernate/annotations/OnDelete.java (revision 33)
@@ -0,0 +1,19 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+
+/**
+ * Strategy to use on collections, arrays and on joined subclasses delete
+ * OnDelete of secondary tables currently not supported.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD, TYPE})
+@Retention(RUNTIME)
+public @interface OnDelete {
+ OnDeleteAction action();
+}
/src/org/hibernate/annotations/OnDelete.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Tuplizers.java
===================================================================
--- src/org/hibernate/annotations/Tuplizers.java (revision 0)
+++ src/org/hibernate/annotations/Tuplizers.java (revision 33)
@@ -0,0 +1,16 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Define a set of tuplizer for an entity or a component
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target( {ElementType.TYPE, ElementType.FIELD, ElementType.METHOD} )
+@Retention( RetentionPolicy.RUNTIME )
+public @interface Tuplizers {
+ Tuplizer[] value();
+}
/src/org/hibernate/annotations/Tuplizers.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/MapKeyManyToMany.java
===================================================================
--- src/org/hibernate/annotations/MapKeyManyToMany.java (revision 0)
+++ src/org/hibernate/annotations/MapKeyManyToMany.java (revision 33)
@@ -0,0 +1,26 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import javax.persistence.JoinColumn;
+
+/**
+ * Define the map key columns as an explicit column holding the map key
+ * This is completly different from {@link javax.persistence.MapKey} which use an existing column
+ * This annotation and {@link javax.persistence.MapKey} are mutually exclusive
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MapKeyManyToMany {
+ JoinColumn[] joinColumns() default {};
+ /**
+ * Represent the key class in a Map
+ * Only useful if the collection does not use generics
+ */
+ Class targetEntity() default void.class;
+}
/src/org/hibernate/annotations/MapKeyManyToMany.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/OrderBy.java
===================================================================
--- src/org/hibernate/annotations/OrderBy.java (revision 0)
+++ src/org/hibernate/annotations/OrderBy.java (revision 33)
@@ -0,0 +1,19 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Order a collection using SQL ordering (not HQL ordering)
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface OrderBy {
+ /** SQL orderby clause */
+ String clause();
+}
/src/org/hibernate/annotations/OrderBy.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Entity.java
===================================================================
--- src/org/hibernate/annotations/Entity.java (revision 0)
+++ src/org/hibernate/annotations/Entity.java (revision 33)
@@ -0,0 +1,31 @@
+//$Id: Entity.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Extends {@link javax.persistence.Entity} with Hibernate features
+ *
+ * @author Emmanuel Bernard
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Entity {
+ /** Is this entity mutable (read only) or not */
+ boolean mutable() default true;
+ /** Needed column only in SQL on insert */
+ boolean dynamicInsert() default false;
+ /** Needed column only in SQL on update */
+ boolean dynamicUpdate() default false;
+ /** Do a select to retrieve the entity before any potential update */
+ boolean selectBeforeUpdate() default false;
+ /** polymorphism strategy for this entity */
+ PolymorphismType polymorphism() default PolymorphismType.IMPLICIT;
+ /** persister of this entity, default is hibernate internal one */
+ String persister() default "";
+ /** optimistic locking strategy */
+ OptimisticLockType optimisticLock() default OptimisticLockType.VERSION;
+}
/src/org/hibernate/annotations/Entity.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Check.java
===================================================================
--- src/org/hibernate/annotations/Check.java (revision 0)
+++ src/org/hibernate/annotations/Check.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: Check.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Arbitrary SQL check constraints which can be defined at the class,
+ * property or collection level
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Check {
+ String constraints();
+}
/src/org/hibernate/annotations/Check.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/FilterJoinTable.java
===================================================================
--- src/org/hibernate/annotations/FilterJoinTable.java (revision 0)
+++ src/org/hibernate/annotations/FilterJoinTable.java (revision 33)
@@ -0,0 +1,20 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Add filters to a join table collection
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface FilterJoinTable {
+ String name();
+
+ String condition() default "";
+}
/src/org/hibernate/annotations/FilterJoinTable.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Tuplizer.java
===================================================================
--- src/org/hibernate/annotations/Tuplizer.java (revision 0)
+++ src/org/hibernate/annotations/Tuplizer.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+
+/**
+ * Define a tuplizer for an entity or a component
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface Tuplizer {
+ /** tuplizer implementation */
+ Class impl();
+ /** either pojo, dynamic-map or dom4j÷ */
+ String entityMode() default "pojo";
+}
/src/org/hibernate/annotations/Tuplizer.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Immutable.java
===================================================================
--- src/org/hibernate/annotations/Immutable.java (revision 0)
+++ src/org/hibernate/annotations/Immutable.java (revision 33)
@@ -0,0 +1,15 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.*;
+
+/**
+ * Mark an Entity or a Collection as immutable
+ * No annotation means the element is mutable
+ *
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention( RetentionPolicy.RUNTIME )
+public @interface Immutable {
+}
/src/org/hibernate/annotations/Immutable.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/ParamDef.java
===================================================================
--- src/org/hibernate/annotations/ParamDef.java (revision 0)
+++ src/org/hibernate/annotations/ParamDef.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: ParamDef.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * A parameter definition
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({})
+@Retention(RUNTIME)
+public @interface ParamDef {
+ String name();
+
+ String type();
+}
/src/org/hibernate/annotations/ParamDef.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Parameter.java
===================================================================
--- src/org/hibernate/annotations/Parameter.java (revision 0)
+++ src/org/hibernate/annotations/Parameter.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: Parameter.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Parameter (basically key/value pattern)
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({})
+@Retention(RUNTIME)
+public @interface Parameter {
+ String name();
+
+ String value();
+}
/src/org/hibernate/annotations/Parameter.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/SQLDelete.java
===================================================================
--- src/org/hibernate/annotations/SQLDelete.java (revision 0)
+++ src/org/hibernate/annotations/SQLDelete.java (revision 33)
@@ -0,0 +1,33 @@
+//$Id:$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * SqlDelete Annotation for overwriting Hibernate default DELETE method
+ *
+ * @author László Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface SQLDelete {
+ /**
+ * Procedure name or DELETE STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
/src/org/hibernate/annotations/SQLDelete.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/LazyToOne.java
===================================================================
--- src/org/hibernate/annotations/LazyToOne.java (revision 0)
+++ src/org/hibernate/annotations/LazyToOne.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Define the lazy status of a ToOne association
+ * (ie OneToOne or ManyToOne)
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface LazyToOne {
+ LazyToOneOption value();
+}
/src/org/hibernate/annotations/LazyToOne.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Filter.java
===================================================================
--- src/org/hibernate/annotations/Filter.java (revision 0)
+++ src/org/hibernate/annotations/Filter.java (revision 33)
@@ -0,0 +1,22 @@
+//$Id: Filter.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Add filters to an entity or a target entity of a collection
+ *
+ * @author Emmanuel Bernard
+ * @author Matthew Inger
+ * @author Magnus Sandberg
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Filter {
+ String name();
+
+ String condition() default "";
+}
/src/org/hibernate/annotations/Filter.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/IndexColumn.java
===================================================================
--- src/org/hibernate/annotations/IndexColumn.java (revision 0)
+++ src/org/hibernate/annotations/IndexColumn.java (revision 33)
@@ -0,0 +1,25 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Describe an index column of a List
+ *
+ * @author Matthew Inger
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface IndexColumn {
+ /** column name */
+ String name();
+ /** index in DB start from base */
+ int base() default 0;
+ /** is the index nullable */
+ boolean nullable() default true;
+ /** column definition, default to an appropriate integer */
+ String columnDefinition() default "";
+}
/src/org/hibernate/annotations/IndexColumn.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/ForceDiscriminator.java
===================================================================
--- src/org/hibernate/annotations/ForceDiscriminator.java (revision 0)
+++ src/org/hibernate/annotations/ForceDiscriminator.java (revision 33)
@@ -0,0 +1,16 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * ForceDiscriminator flag
+ * To be placed at the root entity near @DiscriminatorColumn or @DiscriminatorFormula
+ *
+ * @author Serg Prasolov
+ */
+@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME)
+public @interface ForceDiscriminator {}
/src/org/hibernate/annotations/ForceDiscriminator.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Table.java
===================================================================
--- src/org/hibernate/annotations/Table.java (revision 0)
+++ src/org/hibernate/annotations/Table.java (revision 33)
@@ -0,0 +1,86 @@
+//$Id: Table.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Complementary information to a table either primary or secondary
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface Table {
+ /**
+ * name of the targeted table
+ */
+ String appliesTo();
+
+ /**
+ * Indexes
+ */
+ Index[] indexes() default {};
+
+ /**
+ * define a table comment
+ */
+ String comment() default "";
+
+ /**
+ * Defines the Foreign Key name of a secondary table
+ * pointing back to the primary table
+ */
+ ForeignKey foreignKey() default @ForeignKey( name="" );
+
+ /**
+ * If set to JOIN, the default, Hibernate will use an inner join to retrieve a
+ * secondary table defined by a class or its superclasses and an outer join for a
+ * secondary table defined by a subclass.
+ * If set to select then Hibernate will use a
+ * sequential select for a secondary table defined on a subclass, which will be issued only if a row
+ * turns out to represent an instance of the subclass. Inner joins will still be used to retrieve a
+ * secondary defined by the class and its superclasses.
+ *
+ * <b>Only applies to secondary tables</b>
+ */
+ FetchMode fetch() default FetchMode.JOIN;
+
+ /**
+ * If true, Hibernate will not try to insert or update the properties defined by this join.
+ *
+ * <b>Only applies to secondary tables</b>
+ */
+ boolean inverse() default false;
+
+ /**
+ * If enabled, Hibernate will insert a row only if the properties defined by this join are non-null
+ * and will always use an outer join to retrieve the properties.
+ *
+ * <b>Only applies to secondary tables</b>
+ */
+ boolean optional() default true;
+
+ /**
+ * Defines a custom SQL insert statement
+ *
+ * <b>Only applies to secondary tables</b>
+ */
+ SQLInsert sqlInsert() default @SQLInsert(sql="");
+
+ /**
+ * Defines a custom SQL update statement
+ *
+ * <b>Only applies to secondary tables</b>
+ */
+ SQLUpdate sqlUpdate() default @SQLUpdate(sql="");
+
+ /**
+ * Defines a custom SQL delete statement
+ *
+ * <b>Only applies to secondary tables</b>
+ */
+ SQLDelete sqlDelete() default @SQLDelete(sql="");
+}
/src/org/hibernate/annotations/Table.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/FlushModeType.java
===================================================================
--- src/org/hibernate/annotations/FlushModeType.java (revision 0)
+++ src/org/hibernate/annotations/FlushModeType.java (revision 33)
@@ -0,0 +1,36 @@
+package org.hibernate.annotations;
+
+/**
+ * Enumeration extending javax.persistence flush modes.
+ *
+ * @author Carlos González-Cadenas
+ */
+
+public enum FlushModeType {
+ /**
+ * see {@link org.hibernate.FlushMode.ALWAYS}
+ */
+ ALWAYS,
+ /**
+ * see {@link org.hibernate.FlushMode.AUTO}
+ */
+ AUTO,
+ /**
+ * see {@link org.hibernate.FlushMode.COMMIT}
+ */
+ COMMIT,
+ /**
+ * see {@link org.hibernate.FlushMode.NEVER}
+ * @deprecated use MANUAL, will be removed in a subsequent release
+ */
+ NEVER,
+ /**
+ * see {@link org.hibernate.FlushMode.MANUAL}
+ */
+ MANUAL,
+
+ /**
+ * Current flush mode of the persistence context at the time the query is executed
+ */
+ PERSISTENCE_CONTEXT
+}
\ No newline at end of file
/src/org/hibernate/annotations/FlushModeType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/NotFoundAction.java
===================================================================
--- src/org/hibernate/annotations/NotFoundAction.java (revision 0)
+++ src/org/hibernate/annotations/NotFoundAction.java (revision 33)
@@ -0,0 +1,17 @@
+package org.hibernate.annotations;
+
+/**
+ * Actoin to use when an element is not found in DB while beeing expected
+ *
+ * @author Emmanuel Bernard
+ */
+public enum NotFoundAction {
+ /**
+ * raise an exception when an element is not found (default and recommended)
+ */
+ EXCEPTION,
+ /**
+ * ignore the element when not found in DB
+ */
+ IGNORE
+}
/src/org/hibernate/annotations/NotFoundAction.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/OptimisticLock.java
===================================================================
--- src/org/hibernate/annotations/OptimisticLock.java (revision 0)
+++ src/org/hibernate/annotations/OptimisticLock.java (revision 33)
@@ -0,0 +1,24 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Whether or not update entity's version on property's change
+ * If the annotation is not present, the property is involved in the optimistic lock srategy (default)
+ *
+ * @author Logi Ragnarsson
+ */
+@Target( {ElementType.METHOD, ElementType.FIELD} )
+@Retention( RetentionPolicy.RUNTIME )
+public @interface OptimisticLock {
+
+ /**
+ * If true, the annotated property change will not trigger a version upgrade
+ */
+ boolean excluded();
+
+}
/src/org/hibernate/annotations/OptimisticLock.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/CacheConcurrencyStrategy.java
===================================================================
--- src/org/hibernate/annotations/CacheConcurrencyStrategy.java (revision 0)
+++ src/org/hibernate/annotations/CacheConcurrencyStrategy.java (revision 33)
@@ -0,0 +1,15 @@
+//$Id: CacheConcurrencyStrategy.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+/**
+ * Cache concurrency strategy
+ *
+ * @author Emmanuel Bernard
+ */
+public enum CacheConcurrencyStrategy {
+ NONE,
+ READ_ONLY,
+ NONSTRICT_READ_WRITE,
+ READ_WRITE,
+ TRANSACTIONAL
+}
/src/org/hibernate/annotations/CacheConcurrencyStrategy.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/AccessType.java
===================================================================
--- src/org/hibernate/annotations/AccessType.java (revision 0)
+++ src/org/hibernate/annotations/AccessType.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: AccessType.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Property Access type
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface AccessType {
+ String value();
+}
/src/org/hibernate/annotations/AccessType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/FilterDef.java
===================================================================
--- src/org/hibernate/annotations/FilterDef.java (revision 0)
+++ src/org/hibernate/annotations/FilterDef.java (revision 33)
@@ -0,0 +1,24 @@
+//$Id: FilterDef.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Filter definition
+ *
+ * @author Matthew Inger
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, PACKAGE})
+@Retention(RUNTIME)
+public @interface FilterDef {
+ String name();
+
+ String defaultCondition() default "";
+
+ ParamDef[] parameters() default {};
+}
/src/org/hibernate/annotations/FilterDef.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Index.java
===================================================================
--- src/org/hibernate/annotations/Index.java (revision 0)
+++ src/org/hibernate/annotations/Index.java (revision 33)
@@ -0,0 +1,20 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Define a DB index
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+public @interface Index {
+ String name();
+
+ String[] columnNames() default {};
+}
/src/org/hibernate/annotations/Index.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/CollectionId.java
===================================================================
--- src/org/hibernate/annotations/CollectionId.java (revision 0)
+++ src/org/hibernate/annotations/CollectionId.java (revision 33)
@@ -0,0 +1,26 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import javax.persistence.Column;
+
+/**
+ * Describe an identifier column for a bag (ie an idbag)
+ * EXPERIMENTAL: the structure of this annotation might slightly change (generator() mix strategy and generator
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface CollectionId {
+ /** Collection id column(s) */
+ Column[] columns();
+ /** id type, type.type() must be set */
+ Type type();
+ /** generator name: 'identity' or a defined generator name */
+ String generator();
+}
/src/org/hibernate/annotations/CollectionId.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Where.java
===================================================================
--- src/org/hibernate/annotations/Where.java (revision 0)
+++ src/org/hibernate/annotations/Where.java (revision 33)
@@ -0,0 +1,18 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Where clause to add to the element Entity or target entity of a collection
+ * The clause is written in SQL
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Where {
+ String clause();
+}
/src/org/hibernate/annotations/Where.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/CacheModeType.java
===================================================================
--- src/org/hibernate/annotations/CacheModeType.java (revision 0)
+++ src/org/hibernate/annotations/CacheModeType.java (revision 33)
@@ -0,0 +1,17 @@
+package org.hibernate.annotations;
+
+/**
+ * Enumeration for the different interaction modes between the session and
+ * the Level 2 Cache.
+ *
+ * @author Emmanuel Bernard
+ * @author Carlos González-Cadenas
+ */
+
+public enum CacheModeType {
+ GET,
+ IGNORE,
+ NORMAL,
+ PUT,
+ REFRESH
+}
\ No newline at end of file
/src/org/hibernate/annotations/CacheModeType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/NamedQuery.java
===================================================================
--- src/org/hibernate/annotations/NamedQuery.java (revision 0)
+++ src/org/hibernate/annotations/NamedQuery.java (revision 33)
@@ -0,0 +1,40 @@
+//$Id: NamedQuery.java 14392 2008-03-05 21:57:56Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Extends {@link javax.persistence.NamedQuery} with Hibernate features
+ *
+ * @author Carlos González-Cadenas
+ */
+@Target({TYPE, PACKAGE})
+@Retention(RUNTIME)
+public @interface NamedQuery {
+
+ /** the name of the NamedQuery */
+ String name();
+ /** the Query String for the NamedQuery */
+ String query();
+ /** the flush mode for the query */
+ FlushModeType flushMode() default FlushModeType.PERSISTENCE_CONTEXT;
+ /** mark the query as cacheable or not */
+ boolean cacheable() default false;
+ /** the cache region to use */
+ String cacheRegion() default "";
+ /** the number of rows fetched by the JDBC Driver per roundtrip */
+ int fetchSize() default -1;
+ /**the query timeout in seconds*/
+ int timeout() default -1;
+ /**comment added to the SQL query, useful for the DBA */
+ String comment() default "";
+ /**the cache mode used for this query*/
+ CacheModeType cacheMode() default CacheModeType.NORMAL;
+ /**marks whether the results are fetched in read-only mode or not*/
+ boolean readOnly() default false;
+
+}
/src/org/hibernate/annotations/NamedQuery.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/GenerationTime.java
===================================================================
--- src/org/hibernate/annotations/GenerationTime.java (revision 0)
+++ src/org/hibernate/annotations/GenerationTime.java (revision 33)
@@ -0,0 +1,13 @@
+//$Id: $
+package org.hibernate.annotations;
+
+/**
+ * When should the generation occurs
+ *
+ * @author Emmanuel Bernard
+ */
+public enum GenerationTime {
+ NEVER,
+ INSERT,
+ ALWAYS
+}
/src/org/hibernate/annotations/GenerationTime.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Tables.java
===================================================================
--- src/org/hibernate/annotations/Tables.java (revision 0)
+++ src/org/hibernate/annotations/Tables.java (revision 33)
@@ -0,0 +1,18 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Plural of Table
+ *
+ * @author Emmanuel Bernard
+ * @see Table
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface Tables {
+ Table[] value();
+}
/src/org/hibernate/annotations/Tables.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/CollectionOfElements.java
===================================================================
--- src/org/hibernate/annotations/CollectionOfElements.java (revision 0)
+++ src/org/hibernate/annotations/CollectionOfElements.java (revision 33)
@@ -0,0 +1,28 @@
+//$Id: CollectionOfElements.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import javax.persistence.FetchType;
+import static javax.persistence.FetchType.LAZY;
+
+/**
+ * Annotation used to mark a collection as a collection of elements or
+ * a collection of embedded objects
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface CollectionOfElements {
+ /**
+ * Represent the element class in the collection
+ * Only useful if the collection does not use generics
+ */
+ Class targetElement() default void.class;
+
+ FetchType fetch() default LAZY;
+}
/src/org/hibernate/annotations/CollectionOfElements.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Persister.java
===================================================================
--- src/org/hibernate/annotations/Persister.java (revision 0)
+++ src/org/hibernate/annotations/Persister.java (revision 33)
@@ -0,0 +1,16 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.*;
+
+/**
+ * Specify a custom persister.
+ *
+ * @author Shawn Clowater
+ */
+@java.lang.annotation.Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention( RetentionPolicy.RUNTIME )
+public @interface Persister {
+ /** Custom persister */
+ Class impl();
+}
/src/org/hibernate/annotations/Persister.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Proxy.java
===================================================================
--- src/org/hibernate/annotations/Proxy.java (revision 0)
+++ src/org/hibernate/annotations/Proxy.java (revision 33)
@@ -0,0 +1,26 @@
+//$Id: Proxy.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Lazy and proxy configuration of a particular class
+ *
+ * @author Emmanuel Bernard
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Proxy {
+ /**
+ * Whether this class is lazy or not (default to true)
+ */
+ boolean lazy() default true;
+
+ /**
+ * Proxy class or interface used. Default entity class name.
+ */
+ Class proxyClass() default void.class;
+}
/src/org/hibernate/annotations/Proxy.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Type.java
===================================================================
--- src/org/hibernate/annotations/Type.java (revision 0)
+++ src/org/hibernate/annotations/Type.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id: Type.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * hibernate type
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+public @interface Type {
+ String type();
+
+ Parameter[] parameters() default {};
+}
\ No newline at end of file
/src/org/hibernate/annotations/Type.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/GenericGenerator.java
===================================================================
--- src/org/hibernate/annotations/GenericGenerator.java (revision 0)
+++ src/org/hibernate/annotations/GenericGenerator.java (revision 33)
@@ -0,0 +1,31 @@
+//$Id: GenericGenerator.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Generator annotation describing any kind of Hibernate
+ * generator in a detyped manner
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({PACKAGE, TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface GenericGenerator {
+ /**
+ * unique generator name
+ */
+ String name();
+ /**
+ * Generator strategy either a predefined Hibernate
+ * strategy or a fully qualified class name.
+ */
+ String strategy();
+ /**
+ * Optional generator parameters
+ */
+ Parameter[] parameters() default {};
+}
/src/org/hibernate/annotations/GenericGenerator.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Cascade.java
===================================================================
--- src/org/hibernate/annotations/Cascade.java (revision 0)
+++ src/org/hibernate/annotations/Cascade.java (revision 33)
@@ -0,0 +1,16 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Apply a cascade strategy on an association
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Cascade {
+ CascadeType[] value();
+}
/src/org/hibernate/annotations/Cascade.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/MapKey.java
===================================================================
--- src/org/hibernate/annotations/MapKey.java (revision 0)
+++ src/org/hibernate/annotations/MapKey.java (revision 33)
@@ -0,0 +1,32 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import javax.persistence.Column;
+
+/**
+ * Define the map key columns as an explicit column holding the map key
+ * This is completly different from {@link javax.persistence.MapKey} which use an existing column
+ * This annotation and {@link javax.persistence.MapKey} are mutually exclusive
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface MapKey {
+ Column[] columns() default {};
+ /**
+ * Represent the key class in a Map
+ * Only useful if the collection does not use generics
+ */
+ Class targetElement() default void.class;
+
+ /**
+ * The optional map key type. Guessed if default
+ */
+ Type type() default @Type(type = "");
+}
/src/org/hibernate/annotations/MapKey.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/NamedNativeQueries.java
===================================================================
--- src/org/hibernate/annotations/NamedNativeQueries.java (revision 0)
+++ src/org/hibernate/annotations/NamedNativeQueries.java (revision 33)
@@ -0,0 +1,19 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Extends {@link javax.persistence.NamedNativeQueries} to hold hibernate NamedNativeQuery
+ * objects
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, PACKAGE})
+@Retention(RUNTIME)
+public @interface NamedNativeQueries {
+ NamedNativeQuery[] value();
+}
\ No newline at end of file
/src/org/hibernate/annotations/NamedNativeQueries.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Fetch.java
===================================================================
--- src/org/hibernate/annotations/Fetch.java (revision 0)
+++ src/org/hibernate/annotations/Fetch.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Define the fetching strategy used for the given association
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Fetch {
+ FetchMode value();
+}
/src/org/hibernate/annotations/Fetch.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/ResultCheckStyle.java
===================================================================
--- src/org/hibernate/annotations/ResultCheckStyle.java (revision 0)
+++ src/org/hibernate/annotations/ResultCheckStyle.java (revision 33)
@@ -0,0 +1,31 @@
+//$Id:
+package org.hibernate.annotations;
+
+/**
+ * Possible checks on Sql Insert, Delete, Update
+ *
+ * @author László Benke
+ */
+public enum ResultCheckStyle {
+ /**
+ * Do not perform checking. Either user simply does not want checking, or is
+ * indicating a {@link java.sql.CallableStatement} execution in which the
+ * checks are being performed explicitly and failures are handled through
+ * propogation of {@link java.sql.SQLException}s.
+ */
+ NONE,
+ /**
+ * Perform row-count checking. Row counts are the int values returned by both
+ * {@link java.sql.PreparedStatement#executeUpdate()} and
+ * {@link java.sql.Statement#executeBatch()}. These values are checked
+ * against some expected count.
+ */
+ COUNT,
+ /**
+ * Essentially the same as {@link #COUNT} except that the row count actually
+ * comes from an output parameter registered as part of a
+ * {@link java.sql.CallableStatement}. This style explicitly prohibits
+ * statement batching from being used...
+ */
+ PARAM
+}
/src/org/hibernate/annotations/ResultCheckStyle.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Generated.java
===================================================================
--- src/org/hibernate/annotations/Generated.java (revision 0)
+++ src/org/hibernate/annotations/Generated.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * The annotated property is generated by the database
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.FIELD, ElementType.METHOD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Generated {
+ GenerationTime value();
+}
/src/org/hibernate/annotations/Generated.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/OptimisticLockType.java
===================================================================
--- src/org/hibernate/annotations/OptimisticLockType.java (revision 0)
+++ src/org/hibernate/annotations/OptimisticLockType.java (revision 33)
@@ -0,0 +1,27 @@
+//$Id: OptimisticLockType.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+/**
+ * Optimistic locking strategy
+ * VERSION is the default and recommanded one
+ *
+ * @author Emmanuel Bernard
+ */
+public enum OptimisticLockType {
+ /**
+ * no optimistic locking
+ */
+ NONE,
+ /**
+ * use a column version
+ */
+ VERSION,
+ /**
+ * dirty columns are compared
+ */
+ DIRTY,
+ /**
+ * all columns are compared
+ */
+ ALL
+}
/src/org/hibernate/annotations/OptimisticLockType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/AnyMetaDefs.java
===================================================================
--- src/org/hibernate/annotations/AnyMetaDefs.java (revision 0)
+++ src/org/hibernate/annotations/AnyMetaDefs.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Defines @Any and @ManyToAny set of metadata.
+ * Can be defined at the entity level or the package level
+ *
+ * @author Emmanuel Bernard
+ */
+@java.lang.annotation.Target( { PACKAGE, TYPE } )
+@Retention( RUNTIME )
+public @interface AnyMetaDefs {
+ AnyMetaDef[] value();
+}
/src/org/hibernate/annotations/AnyMetaDefs.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/TypeDef.java
===================================================================
--- src/org/hibernate/annotations/TypeDef.java (revision 0)
+++ src/org/hibernate/annotations/TypeDef.java (revision 33)
@@ -0,0 +1,23 @@
+//$Id: TypeDef.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Type definition
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, PACKAGE})
+@Retention(RUNTIME)
+public @interface TypeDef {
+ String name();
+
+ Class typeClass();
+
+ Parameter[] parameters() default {};
+}
/src/org/hibernate/annotations/TypeDef.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/WhereJoinTable.java
===================================================================
--- src/org/hibernate/annotations/WhereJoinTable.java (revision 0)
+++ src/org/hibernate/annotations/WhereJoinTable.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: $
+package org.hibernate.annotations;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Where clause to add to the colleciton join table
+ * The clause is written in SQL
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface WhereJoinTable {
+ String clause();
+}
/src/org/hibernate/annotations/WhereJoinTable.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/SQLUpdate.java
===================================================================
--- src/org/hibernate/annotations/SQLUpdate.java (revision 0)
+++ src/org/hibernate/annotations/SQLUpdate.java (revision 33)
@@ -0,0 +1,34 @@
+//$Id:$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * SqlUpdate Annotation for overwriting Hibernate default UPDATE method
+ *
+ * @author László Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface SQLUpdate {
+
+ /**
+ * Procedure name or UPDATE STATEMENT
+ */
+ String sql();
+
+ /**
+ * Is the statement using stored procedure or not
+ */
+ boolean callable() default false;
+
+ /**
+ * For persistence operation what style of determining results (success/failure) is to be used.
+ */
+ ResultCheckStyle check() default ResultCheckStyle.NONE;
+}
/src/org/hibernate/annotations/SQLUpdate.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Cache.java
===================================================================
--- src/org/hibernate/annotations/Cache.java (revision 0)
+++ src/org/hibernate/annotations/Cache.java (revision 33)
@@ -0,0 +1,26 @@
+//$Id: Cache.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Add caching strategy to a root entity or a collection
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Cache {
+ /** concurrency strategy chosen */
+ CacheConcurrencyStrategy usage();
+ /** cache region name */
+ String region() default "";
+ /**
+ * whether or not lazy-properties are included in the second level cache
+ * default all, other value: non-lazy
+ */
+ String include() default "all";
+}
/src/org/hibernate/annotations/Cache.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/Loader.java
===================================================================
--- src/org/hibernate/annotations/Loader.java (revision 0)
+++ src/org/hibernate/annotations/Loader.java (revision 33)
@@ -0,0 +1,22 @@
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Loader Annotation for overwriting Hibernate default FIND method
+ *
+ * @author László Benke
+ */
+@Target( {TYPE, FIELD, METHOD} )
+@Retention( RUNTIME )
+public @interface Loader {
+ /**
+ * namedQuery to use for loading
+ */
+ String namedQuery() default "";
+}
/src/org/hibernate/annotations/Loader.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/GenericGenerators.java
===================================================================
--- src/org/hibernate/annotations/GenericGenerators.java (revision 0)
+++ src/org/hibernate/annotations/GenericGenerators.java (revision 33)
@@ -0,0 +1,21 @@
+//$
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Array of generic generator definitions
+ *
+ * @author Paul Cowan
+ */
+@Target({PACKAGE, TYPE})
+@Retention(RUNTIME)
+public @interface GenericGenerators {
+ GenericGenerator[] value();
+}
+
/src/org/hibernate/annotations/GenericGenerators.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/annotations/BatchSize.java
===================================================================
--- src/org/hibernate/annotations/BatchSize.java (revision 0)
+++ src/org/hibernate/annotations/BatchSize.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: BatchSize.java 11282 2007-03-14 22:05:59Z epbernard $
+package org.hibernate.annotations;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Batch size for SQL loading
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface BatchSize {
+ /** Strictly positive integer */
+ int size();
+}
/src/org/hibernate/annotations/BatchSize.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/AssertionFailure.java
===================================================================
--- src/org/hibernate/AssertionFailure.java (revision 0)
+++ src/org/hibernate/AssertionFailure.java (revision 33)
@@ -0,0 +1,55 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import org.hibernate.exception.NestableRuntimeException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Indicates failure of an assertion: a possible bug in Hibernate.
+ *
+ * @author Gavin King
+ */
+public class AssertionFailure extends NestableRuntimeException {
+
+ private static final Logger log = LoggerFactory.getLogger( AssertionFailure.class );
+
+ private static final String MESSAGE = "an assertion failure occured" +
+ " (this may indicate a bug in Hibernate, but is more likely due" +
+ " to unsafe use of the session)";
+
+ public AssertionFailure(String s) {
+ super( s );
+ log.error( MESSAGE, this );
+ }
+
+ public AssertionFailure(String s, Throwable t) {
+ super( s, t );
+ log.error( MESSAGE, t );
+ }
+
+}
/src/org/hibernate/AssertionFailure.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/PropertyNotFoundException.java
===================================================================
--- src/org/hibernate/PropertyNotFoundException.java (revision 0)
+++ src/org/hibernate/PropertyNotFoundException.java (revision 33)
@@ -0,0 +1,39 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Indicates that an expected getter or setter method could not be
+ * found on a class.
+ *
+ * @author Gavin King
+ */
+public class PropertyNotFoundException extends MappingException {
+
+ public PropertyNotFoundException(String s) {
+ super(s);
+ }
+
+}
/src/org/hibernate/PropertyNotFoundException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/EntityMode.java
===================================================================
--- src/org/hibernate/EntityMode.java (revision 0)
+++ src/org/hibernate/EntityMode.java (revision 33)
@@ -0,0 +1,72 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.io.Serializable;
+
+/**
+ * Defines the representation modes available for entities.
+ *
+ * @author Steve Ebersole
+ */
+public class EntityMode implements Serializable {
+
+ private static final Map INSTANCES = new HashMap();
+
+ public static final EntityMode POJO = new EntityMode( "pojo" );
+ public static final EntityMode DOM4J = new EntityMode( "dom4j" );
+ public static final EntityMode MAP = new EntityMode( "dynamic-map" );
+
+ static {
+ INSTANCES.put( POJO.name, POJO );
+ INSTANCES.put( DOM4J.name, DOM4J );
+ INSTANCES.put( MAP.name, MAP );
+ }
+
+ private final String name;
+
+ public EntityMode(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return name;
+ }
+
+ private Object readResolve() {
+ return INSTANCES.get( name );
+ }
+
+ public static EntityMode parse(String name) {
+ EntityMode rtn = ( EntityMode ) INSTANCES.get( name );
+ if ( rtn == null ) {
+ // default is POJO
+ rtn = POJO;
+ }
+ return rtn;
+ }
+}
/src/org/hibernate/EntityMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/Session.java
===================================================================
--- src/org/hibernate/Session.java (revision 0)
+++ src/org/hibernate/Session.java (revision 33)
@@ -0,0 +1,816 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.sql.Connection;
+
+import org.hibernate.jdbc.Work;
+import org.hibernate.stat.SessionStatistics;
+
+/**
+ * The main runtime interface between a Java application and Hibernate. This is the
+ * central API class abstracting the notion of a persistence service.<br>
+ * <br>
+ * The lifecycle of a <tt>Session</tt> is bounded by the beginning and end of a logical
+ * transaction. (Long transactions might span several database transactions.)<br>
+ * <br>
+ * The main function of the <tt>Session</tt> is to offer create, read and delete operations
+ * for instances of mapped entity classes. Instances may exist in one of three states:<br>
+ * <br>
+ * <i>transient:</i> never persistent, not associated with any <tt>Session</tt><br>
+ * <i>persistent:</i> associated with a unique <tt>Session</tt><br>
+ * <i>detached:</i> previously persistent, not associated with any <tt>Session</tt><br>
+ * <br>
+ * Transient instances may be made persistent by calling <tt>save()</tt>,
+ * <tt>persist()</tt> or <tt>saveOrUpdate()</tt>. Persistent instances may be made transient
+ * by calling<tt> delete()</tt>. Any instance returned by a <tt>get()</tt> or
+ * <tt>load()</tt> method is persistent. Detached instances may be made persistent
+ * by calling <tt>update()</tt>, <tt>saveOrUpdate()</tt>, <tt>lock()</tt> or <tt>replicate()</tt>.
+ * The state of a transient or detached instance may also be made persistent as a new
+ * persistent instance by calling <tt>merge()</tt>.<br>
+ * <br>
+ * <tt>save()</tt> and <tt>persist()</tt> result in an SQL <tt>INSERT</tt>, <tt>delete()</tt>
+ * in an SQL <tt>DELETE</tt> and <tt>update()</tt> or <tt>merge()</tt> in an SQL <tt>UPDATE</tt>.
+ * Changes to <i>persistent</i> instances are detected at flush time and also result in an SQL
+ * <tt>UPDATE</tt>. <tt>saveOrUpdate()</tt> and <tt>replicate()</tt> result in either an
+ * <tt>INSERT</tt> or an <tt>UPDATE</tt>.<br>
+ * <br>
+ * It is not intended that implementors be threadsafe. Instead each thread/transaction
+ * should obtain its own instance from a <tt>SessionFactory</tt>.<br>
+ * <br>
+ * A <tt>Session</tt> instance is serializable if its persistent classes are serializable.<br>
+ * <br>
+ * A typical transaction should use the following idiom:
+ * <pre>
+ * Session sess = factory.openSession();
+ * Transaction tx;
+ * try {
+ * tx = sess.beginTransaction();
+ * //do some work
+ * ...
+ * tx.commit();
+ * }
+ * catch (Exception e) {
+ * if (tx!=null) tx.rollback();
+ * throw e;
+ * }
+ * finally {
+ * sess.close();
+ * }
+ * </pre>
+ * <br>
+ * If the <tt>Session</tt> throws an exception, the transaction must be rolled back
+ * and the session discarded. The internal state of the <tt>Session</tt> might not
+ * be consistent with the database after the exception occurs.
+ *
+ * @see SessionFactory
+ * @author Gavin King
+ */
+public interface Session extends Serializable {
+
+ /**
+ * Retrieve the entity mode in effect for this session.
+ *
+ * @return The entity mode for this session.
+ */
+ public EntityMode getEntityMode();
+
+ /**
+ * Starts a new Session with the given entity mode in effect. This secondary
+ * Session inherits the connection, transaction, and other context
+ * information from the primary Session. It doesn't need to be flushed
+ * or closed by the developer.
+ *
+ * @param entityMode The entity mode to use for the new session.
+ * @return The new session
+ */
+ public Session getSession(EntityMode entityMode);
+
+ /**
+ * Force this session to flush. Must be called at the end of a
+ * unit of work, before commiting the transaction and closing the
+ * session (depending on {@link #setFlushMode flush-mode},
+ * {@link Transaction#commit()} calls this method).
+ * <p/>
+ * <i>Flushing</i> is the process of synchronizing the underlying persistent
+ * store with persistable state held in memory.
+ *
+ * @throws HibernateException Indicates problems flushing the session or
+ * talking to the database.
+ */
+ public void flush() throws HibernateException;
+
+ /**
+ * Set the flush mode for this session.
+ * <p/>
+ * The flush mode determines the points at which the session is flushed.
+ * <i>Flushing</i> is the process of synchronizing the underlying persistent
+ * store with persistable state held in memory.
+ * <p/>
+ * For a logically "read only" session, it is reasonable to set the session's
+ * flush mode to {@link FlushMode#MANUAL} at the start of the session (in
+ * order to achieve some extra performance).
+ *
+ * @param flushMode the new flush mode
+ * @see FlushMode
+ */
+ public void setFlushMode(FlushMode flushMode);
+
+ /**
+ * Get the current flush mode for this session.
+ *
+ * @return The flush mode
+ */
+ public FlushMode getFlushMode();
+
+ /**
+ * Set the cache mode.
+ * <p/>
+ * Cache mode determines the manner in which this session can interact with
+ * the second level cache.
+ *
+ * @param cacheMode The new cache mode.
+ */
+ public void setCacheMode(CacheMode cacheMode);
+
+ /**
+ * Get the current cache mode.
+ *
+ * @return The current cache mode.
+ */
+ public CacheMode getCacheMode();
+
+ /**
+ * Get the session factory which created this session.
+ *
+ * @return The session factory.
+ * @see SessionFactory
+
+ */
+ public SessionFactory getSessionFactory();
+
+ /**
+ * Get the JDBC connection of this Session.<br>
+ * <br>
+ * If the session is using aggressive collection release (as in a
+ * CMT environment), it is the application's responsibility to
+ * close the connection returned by this call. Otherwise, the
+ * application should not close the connection.
+ *
+ * @return the JDBC connection in use by the <tt>Session</tt>
+ * @throws HibernateException if the <tt>Session</tt> is disconnected
+ * @deprecated (scheduled for removal in 4.x). Replacement depends on need; for doing direct JDBC stuff use
+ * {@link #doWork}; for opening a 'temporary Session' use (TBD).
+ */
+ public Connection connection() throws HibernateException;
+
+ /**
+ * End the session by releasing the JDBC connection and cleaning up. It is
+ * not strictly necessary to close the session but you must at least
+ * {@link #disconnect()} it.
+ *
+ * @return the connection provided by the application or null.
+ * @throws HibernateException Indicates problems cleaning up.
+ */
+ public Connection close() throws HibernateException;
+
+ /**
+ * Cancel the execution of the current query.
+ * <p/>
+ * This is the sole method on session which may be safely called from
+ * another thread.
+ *
+ * @throws HibernateException There was a problem canceling the query
+ */
+ public void cancelQuery() throws HibernateException;
+
+ /**
+ * Check if the session is still open.
+ *
+ * @return boolean
+ */
+ public boolean isOpen();
+
+ /**
+ * Check if the session is currently connected.
+ *
+ * @return boolean
+ */
+ public boolean isConnected();
+
+ /**
+ * Does this session contain any changes which must be synchronized with
+ * the database? In other words, would any DML operations be executed if
+ * we flushed this session?
+ *
+ * @return True if the session contains pending changes; false otherwise.
+ * @throws HibernateException could not perform dirtying checking
+ */
+ public boolean isDirty() throws HibernateException;
+
+ /**
+ * Return the identifier value of the given entity as associated with this
+ * session. An exception is thrown if the given entity instance is transient
+ * or detached in relation to this session.
+ *
+ * @param object a persistent instance
+ * @return the identifier
+ * @throws TransientObjectException if the instance is transient or associated with
+ * a different session
+ */
+ public Serializable getIdentifier(Object object) throws HibernateException;
+
+ /**
+ * Check if this instance is associated with this <tt>Session</tt>.
+ *
+ * @param object an instance of a persistent class
+ * @return true if the given instance is associated with this <tt>Session</tt>
+ */
+ public boolean contains(Object object);
+
+ /**
+ * Remove this instance from the session cache. Changes to the instance will
+ * not be synchronized with the database. This operation cascades to associated
+ * instances if the association is mapped with <tt>cascade="evict"</tt>.
+ *
+ * @param object a persistent instance
+ * @throws HibernateException
+ */
+ public void evict(Object object) throws HibernateException;
+
+ /**
+ * Return the persistent instance of the given entity class with the given identifier,
+ * obtaining the specified lock mode, assuming the instance exists.
+ *
+ * @param theClass a persistent class
+ * @param id a valid identifier of an existing persistent instance of the class
+ * @param lockMode the lock level
+ * @return the persistent instance or proxy
+ * @throws HibernateException
+ */
+ public Object load(Class theClass, Serializable id, LockMode lockMode) throws HibernateException;
+
+ /**
+ * Return the persistent instance of the given entity class with the given identifier,
+ * obtaining the specified lock mode, assuming the instance exists.
+ *
+ * @param entityName a persistent class
+ * @param id a valid identifier of an existing persistent instance of the class
+ * @param lockMode the lock level
+ * @return the persistent instance or proxy
+ * @throws HibernateException
+ */
+ public Object load(String entityName, Serializable id, LockMode lockMode) throws HibernateException;
+
+ /**
+ * Return the persistent instance of the given entity class with the given identifier,
+ * assuming that the instance exists. This method might return a proxied instance that
+ * is initialized on-demand, when a non-identifier method is accessed.
+ * <br><br>
+ * You should not use this method to determine if an instance exists (use <tt>get()</tt>
+ * instead). Use this only to retrieve an instance that you assume exists, where non-existence
+ * would be an actual error.
+ *
+ * @param theClass a persistent class
+ * @param id a valid identifier of an existing persistent instance of the class
+ * @return the persistent instance or proxy
+ * @throws HibernateException
+ */
+ public Object load(Class theClass, Serializable id) throws HibernateException;
+
+ /**
+ * Return the persistent instance of the given entity class with the given identifier,
+ * assuming that the instance exists. This method might return a proxied instance that
+ * is initialized on-demand, when a non-identifier method is accessed.
+ * <br><br>
+ * You should not use this method to determine if an instance exists (use <tt>get()</tt>
+ * instead). Use this only to retrieve an instance that you assume exists, where non-existence
+ * would be an actual error.
+ *
+ * @param entityName a persistent class
+ * @param id a valid identifier of an existing persistent instance of the class
+ * @return the persistent instance or proxy
+ * @throws HibernateException
+ */
+ public Object load(String entityName, Serializable id) throws HibernateException;
+
+ /**
+ * Read the persistent state associated with the given identifier into the given transient
+ * instance.
+ *
+ * @param object an "empty" instance of the persistent class
+ * @param id a valid identifier of an existing persistent instance of the class
+ * @throws HibernateException
+ */
+ public void load(Object object, Serializable id) throws HibernateException;
+
+ /**
+ * Persist the state of the given detached instance, reusing the current
+ * identifier value. This operation cascades to associated instances if
+ * the association is mapped with <tt>cascade="replicate"</tt>.
+ *
+ * @param object a detached instance of a persistent class
+ */
+ public void replicate(Object object, ReplicationMode replicationMode) throws HibernateException;
+
+ /**
+ * Persist the state of the given detached instance, reusing the current
+ * identifier value. This operation cascades to associated instances if
+ * the association is mapped with <tt>cascade="replicate"</tt>.
+ *
+ * @param object a detached instance of a persistent class
+ */
+ public void replicate(String entityName, Object object, ReplicationMode replicationMode) throws HibernateException;
+
+ /**
+ * Persist the given transient instance, first assigning a generated identifier. (Or
+ * using the current value of the identifier property if the <tt>assigned</tt>
+ * generator is used.) This operation cascades to associated instances if the
+ * association is mapped with <tt>cascade="save-update"</tt>.
+ *
+ * @param object a transient instance of a persistent class
+ * @return the generated identifier
+ * @throws HibernateException
+ */
+ public Serializable save(Object object) throws HibernateException;
+
+ /**
+ * Persist the given transient instance, first assigning a generated identifier. (Or
+ * using the current value of the identifier property if the <tt>assigned</tt>
+ * generator is used.) This operation cascades to associated instances if the
+ * association is mapped with <tt>cascade="save-update"</tt>.
+ *
+ * @param object a transient instance of a persistent class
+ * @return the generated identifier
+ * @throws HibernateException
+ */
+ public Serializable save(String entityName, Object object) throws HibernateException;
+
+ /**
+ * Either {@link #save(Object)} or {@link #update(Object)} the given
+ * instance, depending upon resolution of the unsaved-value checks (see the
+ * manual for discussion of unsaved-value checking).
+ * <p/>
+ * This operation cascades to associated instances if the association is mapped
+ * with <tt>cascade="save-update"</tt>.
+ *
+ * @see Session#save(java.lang.Object)
+ * @see Session#update(Object object)
+ * @param object a transient or detached instance containing new or updated state
+ * @throws HibernateException
+ */
+ public void saveOrUpdate(Object object) throws HibernateException;
+
+ /**
+ * Either {@link #save(String, Object)} or {@link #update(String, Object)}
+ * the given instance, depending upon resolution of the unsaved-value checks
+ * (see the manual for discussion of unsaved-value checking).
+ * <p/>
+ * This operation cascades to associated instances if the association is mapped
+ * with <tt>cascade="save-update"</tt>.
+ *
+ * @see Session#save(String,Object)
+ * @see Session#update(String,Object)
+ * @param object a transient or detached instance containing new or updated state
+ * @throws HibernateException
+ */
+ public void saveOrUpdate(String entityName, Object object) throws HibernateException;
+
+ /**
+ * Update the persistent instance with the identifier of the given detached
+ * instance. If there is a persistent instance with the same identifier,
+ * an exception is thrown. This operation cascades to associated instances
+ * if the association is mapped with <tt>cascade="save-update"</tt>.
+ *
+ * @param object a detached instance containing updated state
+ * @throws HibernateException
+ */
+ public void update(Object object) throws HibernateException;
+
+ /**
+ * Update the persistent instance with the identifier of the given detached
+ * instance. If there is a persistent instance with the same identifier,
+ * an exception is thrown. This operation cascades to associated instances
+ * if the association is mapped with <tt>cascade="save-update"</tt>.
+ *
+ * @param object a detached instance containing updated state
+ * @throws HibernateException
+ */
+ public void update(String entityName, Object object) throws HibernateException;
+
+ /**
+ * Copy the state of the given object onto the persistent object with the same
+ * identifier. If there is no persistent instance currently associated with
+ * the session, it will be loaded. Return the persistent instance. If the
+ * given instance is unsaved, save a copy of and return it as a newly persistent
+ * instance. The given instance does not become associated with the session.
+ * This operation cascades to associated instances if the association is mapped
+ * with <tt>cascade="merge"</tt>.<br>
+ * <br>
+ * The semantics of this method are defined by JSR-220.
+ *
+ * @param object a detached instance with state to be copied
+ * @return an updated persistent instance
+ */
+ public Object merge(Object object) throws HibernateException;
+
+ /**
+ * Copy the state of the given object onto the persistent object with the same
+ * identifier. If there is no persistent instance currently associated with
+ * the session, it will be loaded. Return the persistent instance. If the
+ * given instance is unsaved, save a copy of and return it as a newly persistent
+ * instance. The given instance does not become associated with the session.
+ * This operation cascades to associated instances if the association is mapped
+ * with <tt>cascade="merge"</tt>.<br>
+ * <br>
+ * The semantics of this method are defined by JSR-220.
+ *
+ * @param object a detached instance with state to be copied
+ * @return an updated persistent instance
+ */
+ public Object merge(String entityName, Object object) throws HibernateException;
+
+ /**
+ * Make a transient instance persistent. This operation cascades to associated
+ * instances if the association is mapped with <tt>cascade="persist"</tt>.<br>
+ * <br>
+ * The semantics of this method are defined by JSR-220.
+ *
+ * @param object a transient instance to be made persistent
+ */
+ public void persist(Object object) throws HibernateException;
+ /**
+ * Make a transient instance persistent. This operation cascades to associated
+ * instances if the association is mapped with <tt>cascade="persist"</tt>.<br>
+ * <br>
+ * The semantics of this method are defined by JSR-220.
+ *
+ * @param object a transient instance to be made persistent
+ */
+ public void persist(String entityName, Object object) throws HibernateException;
+
+ /**
+ * Remove a persistent instance from the datastore. The argument may be
+ * an instance associated with the receiving <tt>Session</tt> or a transient
+ * instance with an identifier associated with existing persistent state.
+ * This operation cascades to associated instances if the association is mapped
+ * with <tt>cascade="delete"</tt>.
+ *
+ * @param object the instance to be removed
+ * @throws HibernateException
+ */
+ public void delete(Object object) throws HibernateException;
+
+ /**
+ * Remove a persistent instance from the datastore. The <b>object</b> argument may be
+ * an instance associated with the receiving <tt>Session</tt> or a transient
+ * instance with an identifier associated with existing persistent state.
+ * This operation cascades to associated instances if the association is mapped
+ * with <tt>cascade="delete"</tt>.
+ *
+ * @param entityName The entity name for the instance to be removed.
+ * @param object the instance to be removed
+ * @throws HibernateException
+ */
+ public void delete(String entityName, Object object) throws HibernateException;
+
+ /**
+ * Obtain the specified lock level upon the given object. This may be used to
+ * perform a version check (<tt>LockMode.READ</tt>), to upgrade to a pessimistic
+ * lock (<tt>LockMode.UPGRADE</tt>), or to simply reassociate a transient instance
+ * with a session (<tt>LockMode.NONE</tt>). This operation cascades to associated
+ * instances if the association is mapped with <tt>cascade="lock"</tt>.
+ *
+ * @param object a persistent or transient instance
+ * @param lockMode the lock level
+ * @throws HibernateException
+ */
+ public void lock(Object object, LockMode lockMode) throws HibernateException;
+
+ /**
+ * Obtain the specified lock level upon the given object. This may be used to
+ * perform a version check (<tt>LockMode.READ</tt>), to upgrade to a pessimistic
+ * lock (<tt>LockMode.UPGRADE</tt>), or to simply reassociate a transient instance
+ * with a session (<tt>LockMode.NONE</tt>). This operation cascades to associated
+ * instances if the association is mapped with <tt>cascade="lock"</tt>.
+ *
+ * @param object a persistent or transient instance
+ * @param lockMode the lock level
+ * @throws HibernateException
+ */
+ public void lock(String entityName, Object object, LockMode lockMode) throws HibernateException;
+
+ /**
+ * Re-read the state of the given instance from the underlying database. It is
+ * inadvisable to use this to implement long-running sessions that span many
+ * business tasks. This method is, however, useful in certain special circumstances.
+ * For example
+ * <ul>
+ * <li>where a database trigger alters the object state upon insert or update
+ * <li>after executing direct SQL (eg. a mass update) in the same session
+ * <li>after inserting a <tt>Blob</tt> or <tt>Clob</tt>
+ * </ul>
+ *
+ * @param object a persistent or detached instance
+ * @throws HibernateException
+ */
+ public void refresh(Object object) throws HibernateException;
+
+ /**
+ * Re-read the state of the given instance from the underlying database, with
+ * the given <tt>LockMode</tt>. It is inadvisable to use this to implement
+ * long-running sessions that span many business tasks. This method is, however,
+ * useful in certain special circumstances.
+ *
+ * @param object a persistent or detached instance
+ * @param lockMode the lock mode to use
+ * @throws HibernateException
+ */
+ public void refresh(Object object, LockMode lockMode) throws HibernateException;
+
+ /**
+ * Determine the current lock mode of the given object.
+ *
+ * @param object a persistent instance
+ * @return the current lock mode
+ * @throws HibernateException
+ */
+ public LockMode getCurrentLockMode(Object object) throws HibernateException;
+
+ /**
+ * Begin a unit of work and return the associated <tt>Transaction</tt> object.
+ * If a new underlying transaction is required, begin the transaction. Otherwise
+ * continue the new work in the context of the existing underlying transaction.
+ * The class of the returned <tt>Transaction</tt> object is determined by the
+ * property <tt>hibernate.transaction_factory</tt>.
+ *
+ * @return a Transaction instance
+ * @throws HibernateException
+ * @see Transaction
+ */
+ public Transaction beginTransaction() throws HibernateException;
+
+ /**
+ * Get the <tt>Transaction</tt> instance associated with this session.
+ * The class of the returned <tt>Transaction</tt> object is determined by the
+ * property <tt>hibernate.transaction_factory</tt>.
+ *
+ * @return a Transaction instance
+ * @throws HibernateException
+ * @see Transaction
+ */
+ public Transaction getTransaction();
+
+ /**
+ * Create a new <tt>Criteria</tt> instance, for the given entity class,
+ * or a superclass of an entity class.
+ *
+ * @param persistentClass a class, which is persistent, or has persistent subclasses
+ * @return Criteria
+ */
+ public Criteria createCriteria(Class persistentClass);
+
+ /**
+ * Create a new <tt>Criteria</tt> instance, for the given entity class,
+ * or a superclass of an entity class, with the given alias.
+ *
+ * @param persistentClass a class, which is persistent, or has persistent subclasses
+ * @return Criteria
+ */
+ public Criteria createCriteria(Class persistentClass, String alias);
+
+ /**
+ * Create a new <tt>Criteria</tt> instance, for the given entity name.
+ *
+ * @param entityName
+ * @return Criteria
+ */
+ public Criteria createCriteria(String entityName);
+
+ /**
+ * Create a new <tt>Criteria</tt> instance, for the given entity name,
+ * with the given alias.
+ *
+ * @param entityName
+ * @return Criteria
+ */
+ public Criteria createCriteria(String entityName, String alias);
+
+ /**
+ * Create a new instance of <tt>Query</tt> for the given HQL query string.
+ *
+ * @param queryString a HQL query
+ * @return Query
+ * @throws HibernateException
+ */
+ public Query createQuery(String queryString) throws HibernateException;
+
+ /**
+ * Create a new instance of <tt>SQLQuery</tt> for the given SQL query string.
+ *
+ * @param queryString a SQL query
+ * @return SQLQuery
+ * @throws HibernateException
+ */
+ public SQLQuery createSQLQuery(String queryString) throws HibernateException;
+
+ /**
+ * Create a new instance of <tt>Query</tt> for the given collection and filter string.
+ *
+ * @param collection a persistent collection
+ * @param queryString a Hibernate query
+ * @return Query
+ * @throws HibernateException
+ */
+ public Query createFilter(Object collection, String queryString) throws HibernateException;
+
+ /**
+ * Obtain an instance of <tt>Query</tt> for a named query string defined in the
+ * mapping file.
+ *
+ * @param queryName the name of a query defined externally
+ * @return Query
+ * @throws HibernateException
+ */
+ public Query getNamedQuery(String queryName) throws HibernateException;
+
+ /**
+ * Completely clear the session. Evict all loaded instances and cancel all pending
+ * saves, updates and deletions. Do not close open iterators or instances of
+ * <tt>ScrollableResults</tt>.
+ */
+ public void clear();
+
+ /**
+ * Return the persistent instance of the given entity class with the given identifier,
+ * or null if there is no such persistent instance. (If the instance is already associated
+ * with the session, return that instance. This method never returns an uninitialized instance.)
+ * Obtain the specified lock mode if the instance exists.
+ *
+ * @param clazz a persistent class
+ * @param id an identifier
+ * @return a persistent instance or null
+ * @throws HibernateException
+ */
+ public Object get(Class clazz, Serializable id) throws HibernateException;
+
+ /**
+ * Return the persistent instance of the given entity class with the given identifier,
+ * or null if there is no such persistent instance. (If the instance is already associated
+ * with the session, return that instance. This method never returns an uninitialized instance.)
+ * Obtain the specified lock mode if the instance exists.
+ *
+ * @param clazz a persistent class
+ * @param id an identifier
+ * @param lockMode the lock mode
+ * @return a persistent instance or null
+ * @throws HibernateException
+ */
+ public Object get(Class clazz, Serializable id, LockMode lockMode) throws HibernateException;
+
+ /**
+ * Return the persistent instance of the given named entity with the given identifier,
+ * or null if there is no such persistent instance. (If the instance is already associated
+ * with the session, return that instance. This method never returns an uninitialized instance.)
+ *
+ * @param entityName the entity name
+ * @param id an identifier
+ * @return a persistent instance or null
+ * @throws HibernateException
+ */
+ public Object get(String entityName, Serializable id) throws HibernateException;
+
+ /**
+ * Return the persistent instance of the given entity class with the given identifier,
+ * or null if there is no such persistent instance. (If the instance is already associated
+ * with the session, return that instance. This method never returns an uninitialized instance.)
+ * Obtain the specified lock mode if the instance exists.
+ *
+ * @param entityName the entity name
+ * @param id an identifier
+ * @param lockMode the lock mode
+ * @return a persistent instance or null
+ * @throws HibernateException
+ */
+ public Object get(String entityName, Serializable id, LockMode lockMode) throws HibernateException;
+
+
+ /**
+ * Return the entity name for a persistent entity
+ *
+ * @param object a persistent entity
+ * @return the entity name
+ * @throws HibernateException
+ */
+ public String getEntityName(Object object) throws HibernateException;
+
+ /**
+ * Enable the named filter for this current session.
+ *
+ * @param filterName The name of the filter to be enabled.
+ * @return The Filter instance representing the enabled fiter.
+ */
+ public Filter enableFilter(String filterName);
+
+ /**
+ * Retrieve a currently enabled filter by name.
+ *
+ * @param filterName The name of the filter to be retrieved.
+ * @return The Filter instance representing the enabled fiter.
+ */
+ public Filter getEnabledFilter(String filterName);
+
+ /**
+ * Disable the named filter for the current session.
+ *
+ * @param filterName The name of the filter to be disabled.
+ */
+ public void disableFilter(String filterName);
+
+ /**
+ * Get the statistics for this session.
+ */
+ public SessionStatistics getStatistics();
+
+ /**
+ * Set an unmodified persistent object to read only mode, or a read only
+ * object to modifiable mode. In read only mode, no snapshot is maintained
+ * and the instance is never dirty checked.
+ *
+ * @see Query#setReadOnly(boolean)
+ */
+ public void setReadOnly(Object entity, boolean readOnly);
+
+ /**
+ * Controller for allowing users to perform JDBC related work using the Connection
+ * managed by this Session.
+ *
+ * @param work The work to be performed.
+ * @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
+ */
+ public void doWork(Work work) throws HibernateException;
+
+
+ /**
+ * Disconnect the <tt>Session</tt> from the current JDBC connection. If
+ * the connection was obtained by Hibernate close it and return it to
+ * the connection pool; otherwise, return it to the application.
+ * <p/>
+ * This is used by applications which supply JDBC connections to Hibernate
+ * and which require long-sessions (or long-conversations)
+ * <p/>
+ * Note that disconnect() called on a session where the connection was
+ * retrieved by Hibernate through its configured
+ * {@link org.hibernate.connection.ConnectionProvider} has no effect,
+ * provided {@link ConnectionReleaseMode#ON_CLOSE} is not in effect.
+ *
+ * @return the application-supplied connection or <tt>null</tt>
+ * @see #reconnect(Connection)
+ * @see #reconnect()
+ */
+ Connection disconnect() throws HibernateException;
+
+ /**
+ * Obtain a new JDBC connection. This is used by applications which
+ * require long transactions and do not supply connections to the
+ * session.
+ *
+ * @see #disconnect()
+ * @deprecated Manual reconnection is only needed in the case of
+ * application-supplied connections, in which case the
+ * {@link #reconnect(java.sql.Connection)} for should be used.
+ */
+ void reconnect() throws HibernateException;
+
+ /**
+ * Reconnect to the given JDBC connection. This is used by applications
+ * which require long transactions and use application-supplied connections.
+ *
+ * @param connection a JDBC connection
+ * @see #disconnect()
+ */
+ void reconnect(Connection connection) throws HibernateException;
+}
/src/org/hibernate/Session.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/QueryException.java
===================================================================
--- src/org/hibernate/QueryException.java (revision 0)
+++ src/org/hibernate/QueryException.java (revision 33)
@@ -0,0 +1,71 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * A problem occurred translating a Hibernate query to SQL
+ * due to invalid query syntax, etc.
+ */
+public class QueryException extends HibernateException {
+
+ private String queryString;
+
+ public QueryException(String message) {
+ super(message);
+ }
+ public QueryException(String message, Throwable e) {
+ super(message, e);
+ }
+
+ public QueryException(String message, String queryString) {
+ super(message);
+ this.queryString = queryString;
+ }
+
+ public QueryException(Exception e) {
+ super(e);
+ }
+ public String getQueryString() {
+ return queryString;
+ }
+
+ public void setQueryString(String queryString) {
+ this.queryString = queryString;
+ }
+
+ public String getMessage() {
+ String msg = super.getMessage();
+ if ( queryString!=null ) msg += " [" + queryString + ']';
+ return msg;
+ }
+
+}
+
+
+
+
+
+
+
/src/org/hibernate/QueryException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/Filter.java
===================================================================
--- src/org/hibernate/Filter.java (revision 0)
+++ src/org/hibernate/Filter.java (revision 33)
@@ -0,0 +1,91 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import org.hibernate.engine.FilterDefinition;
+
+import java.util.Collection;
+
+/**
+ * Type definition of Filter. Filter defines the user's view into enabled dynamic filters,
+ * allowing them to set filter parameter values.
+ *
+ * @author Steve Ebersole
+ */
+public interface Filter {
+
+ /**
+ * Get the name of this filter.
+ *
+ * @return This filter's name.
+ */
+ public String getName();
+
+ /**
+ * Get the filter definition containing additional information about the
+ * filter (such as default-condition and expected parameter names/types).
+ *
+ * @return The filter definition
+ */
+ public FilterDefinition getFilterDefinition();
+
+
+ /**
+ * Set the named parameter's value for this filter.
+ *
+ * @param name The parameter's name.
+ * @param value The value to be applied.
+ * @return This FilterImpl instance (for method chaining).
+ */
+ public Filter setParameter(String name, Object value);
+
+ /**
+ * Set the named parameter's value list for this filter. Used
+ * in conjunction with IN-style filter criteria.
+ *
+ * @param name The parameter's name.
+ * @param values The values to be expanded into an SQL IN list.
+ * @return This FilterImpl instance (for method chaining).
+ */
+ public Filter setParameterList(String name, Collection values);
+
+ /**
+ * Set the named parameter's value list for this filter. Used
+ * in conjunction with IN-style filter criteria.
+ *
+ * @param name The parameter's name.
+ * @param values The values to be expanded into an SQL IN list.
+ * @return This FilterImpl instance (for method chaining).
+ */
+ public Filter setParameterList(String name, Object[] values);
+
+ /**
+ * Perform validation of the filter state. This is used to verify the
+ * state of the filter after its enablement and before its use.
+ *
+ * @throws HibernateException If the state is not currently valid.
+ */
+ public void validate() throws HibernateException;
+}
/src/org/hibernate/Filter.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/SQLQuery.java
===================================================================
--- src/org/hibernate/SQLQuery.java (revision 0)
+++ src/org/hibernate/SQLQuery.java (revision 33)
@@ -0,0 +1,116 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import org.hibernate.type.Type;
+
+/**
+ * Allows the user to declare the types and select list injection
+ * points of all entities returned by the query. Also allows
+ * declaration of the type and column alias of any scalar results
+ * of the query.
+ *
+ * @author Gavin King
+ */
+public interface SQLQuery extends Query {
+ /**
+ * Declare a "root" entity, without specifying an alias
+ */
+ public SQLQuery addEntity(String entityName);
+ /**
+ * Declare a "root" entity
+ */
+ public SQLQuery addEntity(String alias, String entityName);
+ /**
+ * Declare a "root" entity, specifying a lock mode
+ */
+ public SQLQuery addEntity(String alias, String entityName, LockMode lockMode);
+ /**
+ * Declare a "root" entity, without specifying an alias
+ */
+ public SQLQuery addEntity(Class entityClass);
+ /**
+ * Declare a "root" entity
+ */
+ public SQLQuery addEntity(String alias, Class entityClass);
+ /**
+ * Declare a "root" entity, specifying a lock mode
+ */
+ public SQLQuery addEntity(String alias, Class entityClass, LockMode lockMode);
+
+ /**
+ * Declare a "joined" entity
+ */
+ public SQLQuery addJoin(String alias, String path);
+ /**
+ * Declare a "joined" entity, specifying a lock mode
+ */
+ public SQLQuery addJoin(String alias, String path, LockMode lockMode);
+
+ /**
+ * Declare a scalar query result
+ */
+ public SQLQuery addScalar(String columnAlias, Type type);
+
+ /**
+ * Declare a scalar query. Hibernate will attempt to automatically detect the underlying type.
+ */
+ public SQLQuery addScalar(String columnAlias);
+
+ /**
+ * Use a predefined named ResultSetMapping
+ */
+ public SQLQuery setResultSetMapping(String name);
+
+ /**
+ * Adds a query space for auto-flush synchronization.
+ *
+ * @param querySpace The query space to be auto-flushed for this query.
+ * @return this, for method chaning
+ */
+ public SQLQuery addSynchronizedQuerySpace(String querySpace);
+
+ /**
+ * Adds an entity name or auto-flush synchronization.
+ *
+ * @param entityName The name of the entity upon whose defined
+ * query spaces we should additionally synchronize.
+ * @return this, for method chaning
+ * @throws MappingException Indicates the given entity name could not be
+ * resolved.
+ */
+ public SQLQuery addSynchronizedEntityName(String entityName) throws MappingException;
+
+ /**
+ * Adds an entity name or auto-flush synchronization.
+ *
+ * @param entityClass The class of the entity upon whose defined
+ * query spaces we should additionally synchronize.
+ * @return this, for method chaning
+ * @throws MappingException Indicates the given entity class could not be
+ * resolved.
+ */
+ public SQLQuery addSynchronizedEntityClass(Class entityClass) throws MappingException;
+}
/src/org/hibernate/SQLQuery.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/Transaction.java
===================================================================
--- src/org/hibernate/Transaction.java (revision 0)
+++ src/org/hibernate/Transaction.java (revision 33)
@@ -0,0 +1,128 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import javax.transaction.Synchronization;
+
+/**
+ * Allows the application to define units of work, while
+ * maintaining abstraction from the underlying transaction
+ * implementation (eg. JTA, JDBC).<br>
+ * <br>
+ * A transaction is associated with a <tt>Session</tt> and is
+ * usually instantiated by a call to <tt>Session.beginTransaction()</tt>.
+ * A single session might span multiple transactions since
+ * the notion of a session (a conversation between the application
+ * and the datastore) is of coarser granularity than the notion of
+ * a transaction. However, it is intended that there be at most one
+ * uncommitted <tt>Transaction</tt> associated with a particular
+ * <tt>Session</tt> at any time.<br>
+ * <br>
+ * Implementors are not intended to be threadsafe.
+ *
+ * @see Session#beginTransaction()
+ * @see org.hibernate.transaction.TransactionFactory
+ * @author Anton van Straaten
+ */
+public interface Transaction {
+
+ /**
+ * Begin a new transaction.
+ */
+ public void begin() throws HibernateException;
+
+ /**
+ * Flush the associated <tt>Session</tt> and end the unit of work (unless
+ * we are in {@link FlushMode#MANUAL}.
+ * </p>
+ * This method will commit the underlying transaction if and only
+ * if the underlying transaction was initiated by this object.
+ *
+ * @throws HibernateException
+ */
+ public void commit() throws HibernateException;
+
+ /**
+ * Force the underlying transaction to roll back.
+ *
+ * @throws HibernateException
+ */
+ public void rollback() throws HibernateException;
+
+ /**
+ * Was this transaction rolled back or set to rollback only?
+ * <p/>
+ * This only accounts for actions initiated from this local transaction.
+ * If, for example, the underlying transaction is forced to rollback via
+ * some other means, this method still reports false because the rollback
+ * was not initiated from here.
+ *
+ * @return boolean True if the transaction was rolled back via this
+ * local transaction; false otherwise.
+ * @throws HibernateException
+ */
+ public boolean wasRolledBack() throws HibernateException;
+
+ /**
+ * Check if this transaction was successfully committed.
+ * <p/>
+ * This method could return <tt>false</tt> even after successful invocation
+ * of {@link #commit}. As an example, JTA based strategies no-op on
+ * {@link #commit} calls if they did not start the transaction; in that case,
+ * they also report {@link #wasCommitted} as false.
+ *
+ * @return boolean True if the transaction was (unequivocally) committed
+ * via this local transaction; false otherwise.
+ * @throws HibernateException
+ */
+ public boolean wasCommitted() throws HibernateException;
+
+ /**
+ * Is this transaction still active?
+ * <p/>
+ * Again, this only returns information in relation to the
+ * local transaction, not the actual underlying transaction.
+ *
+ * @return boolean Treu if this local transaction is still active.
+ */
+ public boolean isActive() throws HibernateException;
+
+ /**
+ * Register a user synchronization callback for this transaction.
+ *
+ * @param synchronization The Synchronization callback to register.
+ * @throws HibernateException
+ */
+ public void registerSynchronization(Synchronization synchronization)
+ throws HibernateException;
+
+ /**
+ * Set the transaction timeout for any transaction started by
+ * a subsequent call to <tt>begin()</tt> on this instance.
+ *
+ * @param seconds The number of seconds before a timeout.
+ */
+ public void setTimeout(int seconds);
+}
/src/org/hibernate/Transaction.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/NonUniqueObjectException.java
===================================================================
--- src/org/hibernate/NonUniqueObjectException.java (revision 0)
+++ src/org/hibernate/NonUniqueObjectException.java (revision 33)
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+import org.hibernate.pretty.MessageHelper;
+
+/**
+ * This exception is thrown when an operation would
+ * break session-scoped identity. This occurs if the
+ * user tries to associate two different instances of
+ * the same Java class with a particular identifier,
+ * in the scope of a single <tt>Session</tt>.
+ *
+ * @author Gavin King
+ */
+public class NonUniqueObjectException extends HibernateException {
+ private final Serializable identifier;
+ private final String entityName;
+
+ public NonUniqueObjectException(String message, Serializable id, String clazz) {
+ super(message);
+ this.entityName = clazz;
+ this.identifier = id;
+ }
+
+ public NonUniqueObjectException(Serializable id, String clazz) {
+ this("a different object with the same identifier value was already associated with the session", id, clazz);
+ }
+
+ public Serializable getIdentifier() {
+ return identifier;
+ }
+
+ public String getMessage() {
+ return super.getMessage() + ": " +
+ MessageHelper.infoString(entityName, identifier);
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+}
/src/org/hibernate/NonUniqueObjectException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/MappingNotFoundException.java
===================================================================
--- src/org/hibernate/MappingNotFoundException.java (revision 0)
+++ src/org/hibernate/MappingNotFoundException.java (revision 33)
@@ -0,0 +1,64 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown when a resource for a mapping could not be found.
+ *
+ * @author Max Rydahl Andersen
+ */
+public class MappingNotFoundException extends MappingException {
+
+ private final String path;
+ private final String type;
+
+ public MappingNotFoundException(String customMessage, String type, String path, Throwable cause) {
+ super(customMessage, cause);
+ this.type=type;
+ this.path=path;
+ }
+
+ public MappingNotFoundException(String customMessage, String type, String path) {
+ super(customMessage);
+ this.type=type;
+ this.path=path;
+ }
+
+ public MappingNotFoundException(String type, String path) {
+ this(type + ": " + path + " not found", type, path);
+ }
+
+ public MappingNotFoundException(String type, String path, Throwable cause) {
+ this(type + ": " + path + " not found", type, path, cause);
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getPath() {
+ return path;
+ }
+}
/src/org/hibernate/MappingNotFoundException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/LockMode.java
===================================================================
--- src/org/hibernate/LockMode.java (revision 0)
+++ src/org/hibernate/LockMode.java (revision 33)
@@ -0,0 +1,129 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Instances represent a lock mode for a row of a relational
+ * database table. It is not intended that users spend much
+ * time worrying about locking since Hibernate usually
+ * obtains exactly the right lock level automatically.
+ * Some "advanced" users may wish to explicitly specify lock
+ * levels.
+ *
+ * @see Session#lock(Object,LockMode)
+ * @author Gavin King
+ */
+public final class LockMode implements Serializable {
+ private final int level;
+ private final String name;
+ private static final Map INSTANCES = new HashMap();
+
+ private LockMode(int level, String name) {
+ this.level=level;
+ this.name=name;
+ }
+ public String toString() {
+ return name;
+ }
+ /**
+ * Check if this lock mode is more restrictive than the given lock mode.
+ *
+ * @param mode LockMode to check
+ * @return true if this lock mode is more restrictive than given lock mode
+ */
+ public boolean greaterThan(LockMode mode) {
+ return level > mode.level;
+ }
+ /**
+ * Check if this lock mode is less restrictive than the given lock mode.
+ *
+ * @param mode LockMode to check
+ * @return true if this lock mode is less restrictive than given lock mode
+ */
+ public boolean lessThan(LockMode mode) {
+ return level < mode.level;
+ }
+ /**
+ * No lock required. If an object is requested with this lock
+ * mode, a <tt>READ</tt> lock will be obtained if it is
+ * necessary to actually read the state from the database,
+ * rather than pull it from a cache.<br>
+ * <br>
+ * This is the "default" lock mode.
+ */
+ public static final LockMode NONE = new LockMode(0, "NONE");
+ /**
+ * A shared lock. Objects in this lock mode were read from
+ * the database in the current transaction, rather than being
+ * pulled from a cache.
+ */
+ public static final LockMode READ = new LockMode(5, "READ");
+ /**
+ * An upgrade lock. Objects loaded in this lock mode are
+ * materialized using an SQL <tt>select ... for update</tt>.
+ */
+ public static final LockMode UPGRADE = new LockMode(10, "UPGRADE");
+ /**
+ * Attempt to obtain an upgrade lock, using an Oracle-style
+ * <tt>select for update nowait</tt>. The semantics of
+ * this lock mode, once obtained, are the same as
+ * <tt>UPGRADE</tt>.
+ */
+ public static final LockMode UPGRADE_NOWAIT = new LockMode(10, "UPGRADE_NOWAIT");
+ /**
+ * A <tt>WRITE</tt> lock is obtained when an object is updated
+ * or inserted. This lock mode is for internal use only and is
+ * not a valid mode for <tt>load()</tt> or <tt>lock()</tt> (both
+ * of which throw exceptions if WRITE is specified).
+ */
+ public static final LockMode WRITE = new LockMode(10, "WRITE");
+
+ /**
+ * Similiar to {@link #UPGRADE} except that, for versioned entities,
+ * it results in a forced version increment.
+ */
+ public static final LockMode FORCE = new LockMode( 15, "FORCE" );
+
+ static {
+ INSTANCES.put( NONE.name, NONE );
+ INSTANCES.put( READ.name, READ );
+ INSTANCES.put( UPGRADE.name, UPGRADE );
+ INSTANCES.put( UPGRADE_NOWAIT.name, UPGRADE_NOWAIT );
+ INSTANCES.put( WRITE.name, WRITE );
+ INSTANCES.put( FORCE.name, FORCE );
+ }
+
+ private Object readResolve() {
+ return parse( name );
+ }
+
+ public static LockMode parse(String name) {
+ return ( LockMode ) INSTANCES.get(name);
+ }
+}
/src/org/hibernate/LockMode.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/Interceptor.java
===================================================================
--- src/org/hibernate/Interceptor.java (revision 0)
+++ src/org/hibernate/Interceptor.java (revision 33)
@@ -0,0 +1,178 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+import org.hibernate.type.Type;
+
+/**
+ * Allows user code to inspect and/or change property values.
+ * <br><br>
+ * Inspection occurs before property values are written and after they are read
+ * from the database.<br>
+ * <br>
+ * There might be a single instance of <tt>Interceptor</tt> for a <tt>SessionFactory</tt>, or a new instance
+ * might be specified for each <tt>Session</tt>. Whichever approach is used, the interceptor must be
+ * serializable if the <tt>Session</tt> is to be serializable. This means that <tt>SessionFactory</tt>-scoped
+ * interceptors should implement <tt>readResolve()</tt>.<br>
+ * <br>
+ * The <tt>Session</tt> may not be invoked from a callback (nor may a callback cause a collection or proxy to
+ * be lazily initialized).<br>
+ * <br>
+ * Instead of implementing this interface directly, it is usually better to extend <tt>EmptyInterceptor</tt>
+ * and override only the callback methods of interest.
+ *
+ * @see SessionFactory#openSession(Interceptor)
+ * @see org.hibernate.cfg.Configuration#setInterceptor(Interceptor)
+ * @see EmptyInterceptor
+ * @author Gavin King
+ */
+public interface Interceptor {
+ /**
+ * Called just before an object is initialized. The interceptor may change the <tt>state</tt>, which will
+ * be propagated to the persistent object. Note that when this method is called, <tt>entity</tt> will be
+ * an empty uninitialized instance of the class.
+ *
+ * @return <tt>true</tt> if the user modified the <tt>state</tt> in any way.
+ */
+ public boolean onLoad(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
+ /**
+ * Called when an object is detected to be dirty, during a flush. The interceptor may modify the detected
+ * <tt>currentState</tt>, which will be propagated to both the database and the persistent object.
+ * Note that not all flushes end in actual synchronization with the database, in which case the
+ * new <tt>currentState</tt> will be propagated to the object, but not necessarily (immediately) to
+ * the database. It is strongly recommended that the interceptor <b>not</b> modify the <tt>previousState</tt>.
+ *
+ * @return <tt>true</tt> if the user modified the <tt>currentState</tt> in any way.
+ */
+ public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) throws CallbackException;
+ /**
+ * Called before an object is saved. The interceptor may modify the <tt>state</tt>, which will be used for
+ * the SQL <tt>INSERT</tt> and propagated to the persistent object.
+ *
+ * @return <tt>true</tt> if the user modified the <tt>state</tt> in any way.
+ */
+ public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
+ /**
+ * Called before an object is deleted. It is not recommended that the interceptor modify the <tt>state</tt>.
+ */
+ public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) throws CallbackException;
+ /**
+ * Called before a collection is (re)created.
+ */
+ public void onCollectionRecreate(Object collection, Serializable key) throws CallbackException;
+ /**
+ * Called before a collection is deleted.
+ */
+ public void onCollectionRemove(Object collection, Serializable key) throws CallbackException;
+ /**
+ * Called before a collection is updated.
+ */
+ public void onCollectionUpdate(Object collection, Serializable key) throws CallbackException;
+ /**
+ * Called before a flush
+ */
+ public void preFlush(Iterator entities) throws CallbackException;
+ /**
+ * Called after a flush that actually ends in execution of the SQL statements required to synchronize
+ * in-memory state with the database.
+ */
+ public void postFlush(Iterator entities) throws CallbackException;
+ /**
+ * Called to distinguish between transient and detached entities. The return value determines the
+ * state of the entity with respect to the current session.
+ * <ul>
+ * <li><tt>Boolean.TRUE</tt> - the entity is transient
+ * <li><tt>Boolean.FALSE</tt> - the entity is detached
+ * <li><tt>null</tt> - Hibernate uses the <tt>unsaved-value</tt> mapping and other heuristics to
+ * determine if the object is unsaved
+ * </ul>
+ * @param entity a transient or detached entity
+ * @return Boolean or <tt>null</tt> to choose default behaviour
+ */
+ public Boolean isTransient(Object entity);
+ /**
+ * Called from <tt>flush()</tt>. The return value determines whether the entity is updated
+ * <ul>
+ * <li>an array of property indices - the entity is dirty
+ * <li>an empty array - the entity is not dirty
+ * <li><tt>null</tt> - use Hibernate's default dirty-checking algorithm
+ * </ul>
+ * @param entity a persistent entity
+ * @return array of dirty property indices or <tt>null</tt> to choose default behaviour
+ */
+ public int[] findDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types);
+ /**
+ * Instantiate the entity class. Return <tt>null</tt> to indicate that Hibernate should use
+ * the default constructor of the class. The identifier property of the returned instance
+ * should be initialized with the given identifier.
+ *
+ * @param entityName the name of the entity
+ * @param entityMode The type of entity instance to be returned.
+ * @param id the identifier of the new instance
+ * @return an instance of the class, or <tt>null</tt> to choose default behaviour
+ */
+ public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException;
+
+ /**
+ * Get the entity name for a persistent or transient instance
+ * @param object an entity instance
+ * @return the name of the entity
+ */
+ public String getEntityName(Object object) throws CallbackException;
+
+ /**
+ * Get a fully loaded entity instance that is cached externally
+ * @param entityName the name of the entity
+ * @param id the instance identifier
+ * @return a fully initialized entity
+ * @throws CallbackException
+ */
+ public Object getEntity(String entityName, Serializable id) throws CallbackException;
+
+ /**
+ * Called when a Hibernate transaction is begun via the Hibernate <tt>Transaction</tt>
+ * API. Will not be called if transactions are being controlled via some other
+ * mechanism (CMT, for example).
+ */
+ public void afterTransactionBegin(Transaction tx);
+ /**
+ * Called before a transaction is committed (but not before rollback).
+ */
+ public void beforeTransactionCompletion(Transaction tx);
+ /**
+ * Called after a transaction is committed or rolled back.
+ */
+ public void afterTransactionCompletion(Transaction tx);
+
+ /**
+ * Called when sql string is being prepared.
+ * @param sql sql to be prepared
+ * @return original or modified sql
+ */
+ public String onPrepareStatement(String sql);
+}
/src/org/hibernate/Interceptor.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/NonUniqueResultException.java
===================================================================
--- src/org/hibernate/NonUniqueResultException.java (revision 0)
+++ src/org/hibernate/NonUniqueResultException.java (revision 33)
@@ -0,0 +1,40 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown when the application calls <tt>Query.uniqueResult()</tt> and
+ * the query returned more than one result. Unlike all other Hibernate
+ * exceptions, this one is recoverable!
+ *
+ * @author Gavin King
+ */
+public class NonUniqueResultException extends HibernateException {
+
+ public NonUniqueResultException(int resultCount) {
+ super( "query did not return a unique result: " + resultCount );
+ }
+
+}
/src/org/hibernate/NonUniqueResultException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/PropertyValueException.java
===================================================================
--- src/org/hibernate/PropertyValueException.java (revision 0)
+++ src/org/hibernate/PropertyValueException.java (revision 33)
@@ -0,0 +1,79 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import org.hibernate.util.StringHelper;
+
+/**
+ * Thrown when the (illegal) value of a property can not be persisted.
+ * There are two main causes:
+ * <ul>
+ * <li>a property declared <tt>not-null="true"</tt> is null
+ * <li>an association references an unsaved transient instance
+ * </ul>
+ * @author Gavin King
+ */
+public class PropertyValueException extends HibernateException {
+
+ private final String entityName;
+ private final String propertyName;
+
+ public PropertyValueException(String s, String entityName, String propertyName) {
+ super(s);
+ this.entityName = entityName;
+ this.propertyName = propertyName;
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public String getMessage() {
+ return super.getMessage() + ": " +
+ StringHelper.qualify(entityName, propertyName);
+ }
+
+ /**
+ * Return a well formed property path.
+ * Basicaly, it will return parent.child
+ *
+ * @param parent parent in path
+ * @param child child in path
+ * @return parent-child path
+ */
+ public static String buildPropertyPath(String parent, String child) {
+ return new StringBuffer(parent).append('.').append(child).toString();
+ }
+}
+
+
+
+
+
+
/src/org/hibernate/PropertyValueException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/WrongClassException.java
===================================================================
--- src/org/hibernate/WrongClassException.java (revision 0)
+++ src/org/hibernate/WrongClassException.java (revision 33)
@@ -0,0 +1,70 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.Serializable;
+
+/**
+ * Thrown when <tt>Session.load()</tt> selects a row with
+ * the given primary key (identifier value) but the row's
+ * discriminator value specifies a subclass that is not
+ * assignable to the class requested by the user.
+ *
+ * @author Gavin King
+ */
+public class WrongClassException extends HibernateException {
+
+ private final Serializable identifier;
+ private final String entityName;
+
+ public WrongClassException(String msg, Serializable identifier, String clazz) {
+ super(msg);
+ this.identifier = identifier;
+ this.entityName = clazz;
+ }
+ public Serializable getIdentifier() {
+ return identifier;
+ }
+
+ public String getMessage() {
+ return "Object with id: " +
+ identifier +
+ " was not of the specified subclass: " +
+ entityName +
+ " (" + super.getMessage() + ")" ;
+ }
+
+ public String getEntityName() {
+ return entityName;
+ }
+
+}
+
+
+
+
+
+
+
/src/org/hibernate/WrongClassException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/Hibernate.java
===================================================================
--- src/org/hibernate/Hibernate.java (revision 0)
+++ src/org/hibernate/Hibernate.java (revision 33)
@@ -0,0 +1,477 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.Serializable;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.hibernate.collection.PersistentCollection;
+import org.hibernate.engine.HibernateIterator;
+import org.hibernate.intercept.FieldInterceptionHelper;
+import org.hibernate.intercept.FieldInterceptor;
+import org.hibernate.lob.BlobImpl;
+import org.hibernate.lob.ClobImpl;
+import org.hibernate.lob.SerializableBlob;
+import org.hibernate.lob.SerializableClob;
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+import org.hibernate.type.AnyType;
+import org.hibernate.type.BigDecimalType;
+import org.hibernate.type.BigIntegerType;
+import org.hibernate.type.BinaryType;
+import org.hibernate.type.BlobType;
+import org.hibernate.type.BooleanType;
+import org.hibernate.type.ByteType;
+import org.hibernate.type.CalendarDateType;
+import org.hibernate.type.CalendarType;
+import org.hibernate.type.CharacterType;
+import org.hibernate.type.ClassType;
+import org.hibernate.type.ClobType;
+import org.hibernate.type.CompositeCustomType;
+import org.hibernate.type.CurrencyType;
+import org.hibernate.type.CustomType;
+import org.hibernate.type.DateType;
+import org.hibernate.type.DoubleType;
+import org.hibernate.type.FloatType;
+import org.hibernate.type.IntegerType;
+import org.hibernate.type.LocaleType;
+import org.hibernate.type.LongType;
+import org.hibernate.type.ManyToOneType;
+import org.hibernate.type.NullableType;
+import org.hibernate.type.SerializableType;
+import org.hibernate.type.ShortType;
+import org.hibernate.type.StringType;
+import org.hibernate.type.TextType;
+import org.hibernate.type.TimeType;
+import org.hibernate.type.TimeZoneType;
+import org.hibernate.type.TimestampType;
+import org.hibernate.type.TrueFalseType;
+import org.hibernate.type.Type;
+import org.hibernate.type.YesNoType;
+import org.hibernate.type.CharArrayType;
+import org.hibernate.type.WrapperBinaryType;
+import org.hibernate.type.CharacterArrayType;
+import org.hibernate.usertype.CompositeUserType;
+
+/**
+ * <ul>
+ * <li>Provides access to the full range of Hibernate built-in types. <tt>Type</tt>
+ * instances may be used to bind values to query parameters.
+ * <li>A factory for new <tt>Blob</tt>s and <tt>Clob</tt>s.
+ * <li>Defines static methods for manipulation of proxies.
+ * </ul>
+ *
+ * @author Gavin King
+ * @see java.sql.Clob
+ * @see java.sql.Blob
+ * @see org.hibernate.type.Type
+ */
+
+public final class Hibernate {
+
+ /**
+ * Hibernate <tt>long</tt> type.
+ */
+ public static final NullableType LONG = new LongType();
+ /**
+ * Hibernate <tt>short</tt> type.
+ */
+ public static final NullableType SHORT = new ShortType();
+ /**
+ * Hibernate <tt>integer</tt> type.
+ */
+ public static final NullableType INTEGER = new IntegerType();
+ /**
+ * Hibernate <tt>byte</tt> type.
+ */
+ public static final NullableType BYTE = new ByteType();
+ /**
+ * Hibernate <tt>float</tt> type.
+ */
+ public static final NullableType FLOAT = new FloatType();
+ /**
+ * Hibernate <tt>double</tt> type.
+ */
+ public static final NullableType DOUBLE = new DoubleType();
+ /**
+ * Hibernate <tt>character</tt> type.
+ */
+ public static final NullableType CHARACTER = new CharacterType();
+ /**
+ * Hibernate <tt>string</tt> type.
+ */
+ public static final NullableType STRING = new StringType();
+ /**
+ * Hibernate <tt>time</tt> type.
+ */
+ public static final NullableType TIME = new TimeType();
+ /**
+ * Hibernate <tt>date</tt> type.
+ */
+ public static final NullableType DATE = new DateType();
+ /**
+ * Hibernate <tt>timestamp</tt> type.
+ */
+ public static final NullableType TIMESTAMP = new TimestampType();
+ /**
+ * Hibernate <tt>boolean</tt> type.
+ */
+ public static final NullableType BOOLEAN = new BooleanType();
+ /**
+ * Hibernate <tt>true_false</tt> type.
+ */
+ public static final NullableType TRUE_FALSE = new TrueFalseType();
+ /**
+ * Hibernate <tt>yes_no</tt> type.
+ */
+ public static final NullableType YES_NO = new YesNoType();
+ /**
+ * Hibernate <tt>big_decimal</tt> type.
+ */
+ public static final NullableType BIG_DECIMAL = new BigDecimalType();
+ /**
+ * Hibernate <tt>big_integer</tt> type.
+ */
+ public static final NullableType BIG_INTEGER = new BigIntegerType();
+ /**
+ * Hibernate <tt>binary</tt> type.
+ */
+ public static final NullableType BINARY = new BinaryType();
+ /**
+ * Hibernate <tt>wrapper-binary</tt> type.
+ */
+ public static final NullableType WRAPPER_BINARY = new WrapperBinaryType();
+ /**
+ * Hibernate char[] type.
+ */
+ public static final NullableType CHAR_ARRAY = new CharArrayType();
+ /**
+ * Hibernate Character[] type.
+ */
+ public static final NullableType CHARACTER_ARRAY = new CharacterArrayType();
+ /**
+ * Hibernate <tt>text</tt> type.
+ */
+ public static final NullableType TEXT = new TextType();
+ /**
+ * Hibernate <tt>blob</tt> type.
+ */
+ public static final Type BLOB = new BlobType();
+ /**
+ * Hibernate <tt>clob</tt> type.
+ */
+ public static final Type CLOB = new ClobType();
+ /**
+ * Hibernate <tt>calendar</tt> type.
+ */
+ public static final NullableType CALENDAR = new CalendarType();
+ /**
+ * Hibernate <tt>calendar_date</tt> type.
+ */
+ public static final NullableType CALENDAR_DATE = new CalendarDateType();
+ /**
+ * Hibernate <tt>locale</tt> type.
+ */
+ public static final NullableType LOCALE = new LocaleType();
+ /**
+ * Hibernate <tt>currency</tt> type.
+ */
+ public static final NullableType CURRENCY = new CurrencyType();
+ /**
+ * Hibernate <tt>timezone</tt> type.
+ */
+ public static final NullableType TIMEZONE = new TimeZoneType();
+ /**
+ * Hibernate <tt>class</tt> type.
+ */
+ public static final NullableType CLASS = new ClassType();
+ /**
+ * Hibernate <tt>serializable</tt> type.
+ */
+ public static final NullableType SERIALIZABLE = new SerializableType( Serializable.class );
+ /**
+ * Hibernate <tt>object</tt> type.
+ */
+ public static final Type OBJECT = new AnyType();
+
+
+ /**
+ * Cannot be instantiated.
+ */
+ private Hibernate() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * A Hibernate <tt>serializable</tt> type.
+ */
+ public static Type serializable(Class serializableClass) {
+ return new SerializableType( serializableClass );
+ }
+
+ /**
+ * A Hibernate <tt>any</tt> type.
+ *
+ * @param metaType a type mapping <tt>java.lang.Class</tt> to a single column
+ * @param identifierType the entity identifier type
+ * @return the Type
+ */
+ public static Type any(Type metaType, Type identifierType) {
+ return new AnyType( metaType, identifierType );
+ }
+
+ /**
+ * A Hibernate persistent object (entity) type.
+ *
+ * @param persistentClass a mapped entity class
+ */
+ public static Type entity(Class persistentClass) {
+ // not really a many-to-one association *necessarily*
+ return new ManyToOneType( persistentClass.getName() );
+ }
+
+ /**
+ * A Hibernate persistent object (entity) type.
+ *
+ * @param entityName a mapped entity class
+ */
+ public static Type entity(String entityName) {
+ // not really a many-to-one association *necessarily*
+ return new ManyToOneType( entityName );
+ }
+
+ /**
+ * A Hibernate custom type.
+ *
+ * @param userTypeClass a class that implements <tt>UserType</tt>
+ */
+ public static Type custom(Class userTypeClass) throws HibernateException {
+ return custom( userTypeClass, null );
+ }
+
+ /**
+ * A Hibernate parameterizable custom type.
+ *
+ * @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
+ * @param parameterNames the names of the parameters passed to the type
+ * @param parameterValues the values of the parameters passed to the type. They must match
+ * up with the order and length of the parameterNames array.
+ */
+ public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues)
+ throws HibernateException {
+ Properties parameters = new Properties();
+ for ( int i = 0; i < parameterNames.length; i++ ) {
+ parameters.setProperty( parameterNames[i], parameterValues[i] );
+ }
+ return custom( userTypeClass, parameters );
+ }
+
+ /**
+ * A Hibernate parameterizable custom type.
+ *
+ * @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
+ * @param parameters the parameters as a collection of name/value pairs
+ */
+ public static Type custom(Class userTypeClass, Properties parameters)
+ throws HibernateException {
+ if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
+ CompositeCustomType type = new CompositeCustomType( userTypeClass, parameters );
+ return type;
+ }
+ else {
+ CustomType type = new CustomType( userTypeClass, parameters );
+ return type;
+ }
+ }
+
+ /**
+ * Force initialization of a proxy or persistent collection.
+ * <p/>
+ * Note: This only ensures intialization of a proxy object or collection;
+ * it is not guaranteed that the elements INSIDE the collection will be initialized/materialized.
+ *
+ * @param proxy a persistable object, proxy, persistent collection or <tt>null</tt>
+ * @throws HibernateException if we can't initialize the proxy at this time, eg. the <tt>Session</tt> was closed
+ */
+ public static void initialize(Object proxy) throws HibernateException {
+ if ( proxy == null ) {
+ return;
+ }
+ else if ( proxy instanceof HibernateProxy ) {
+ ( ( HibernateProxy ) proxy ).getHibernateLazyInitializer().initialize();
+ }
+ else if ( proxy instanceof PersistentCollection ) {
+ ( ( PersistentCollection ) proxy ).forceInitialization();
+ }
+ }
+
+ /**
+ * Check if the proxy or persistent collection is initialized.
+ *
+ * @param proxy a persistable object, proxy, persistent collection or <tt>null</tt>
+ * @return true if the argument is already initialized, or is not a proxy or collection
+ */
+ public static boolean isInitialized(Object proxy) {
+ if ( proxy instanceof HibernateProxy ) {
+ return !( ( HibernateProxy ) proxy ).getHibernateLazyInitializer().isUninitialized();
+ }
+ else if ( proxy instanceof PersistentCollection ) {
+ return ( ( PersistentCollection ) proxy ).wasInitialized();
+ }
+ else {
+ return true;
+ }
+ }
+
+ /**
+ * Get the true, underlying class of a proxied persistent class. This operation
+ * will initialize a proxy by side-effect.
+ *
+ * @param proxy a persistable object or proxy
+ * @return the true class of the instance
+ * @throws HibernateException
+ */
+ public static Class getClass(Object proxy) {
+ if ( proxy instanceof HibernateProxy ) {
+ return ( ( HibernateProxy ) proxy ).getHibernateLazyInitializer()
+ .getImplementation()
+ .getClass();
+ }
+ else {
+ return proxy.getClass();
+ }
+ }
+
+ /**
+ * Create a new <tt>Blob</tt>. The returned object will be initially immutable.
+ *
+ * @param bytes a byte array
+ * @return the Blob
+ */
+ public static Blob createBlob(byte[] bytes) {
+ return new SerializableBlob( new BlobImpl( bytes ) );
+ }
+
+ /**
+ * Create a new <tt>Blob</tt>. The returned object will be initially immutable.
+ *
+ * @param stream a binary stream
+ * @param length the number of bytes in the stream
+ * @return the Blob
+ */
+ public static Blob createBlob(InputStream stream, int length) {
+ return new SerializableBlob( new BlobImpl( stream, length ) );
+ }
+
+ /**
+ * Create a new <tt>Blob</tt>. The returned object will be initially immutable.
+ *
+ * @param stream a binary stream
+ * @return the Blob
+ * @throws IOException
+ */
+ public static Blob createBlob(InputStream stream) throws IOException {
+ return new SerializableBlob( new BlobImpl( stream, stream.available() ) );
+ }
+
+ /**
+ * Create a new <tt>Clob</tt>. The returned object will be initially immutable.
+ *
+ * @param string a <tt>String</tt>
+ */
+ public static Clob createClob(String string) {
+ return new SerializableClob( new ClobImpl( string ) );
+ }
+
+ /**
+ * Create a new <tt>Clob</tt>. The returned object will be initially immutable.
+ *
+ * @param reader a character stream
+ * @param length the number of characters in the stream
+ */
+ public static Clob createClob(Reader reader, int length) {
+ return new SerializableClob( new ClobImpl( reader, length ) );
+ }
+
+ /**
+ * Close an <tt>Iterator</tt> created by <tt>iterate()</tt> immediately,
+ * instead of waiting until the session is closed or disconnected.
+ *
+ * @param iterator an <tt>Iterator</tt> created by <tt>iterate()</tt>
+ * @throws HibernateException
+ * @see org.hibernate.Query#iterate
+ * @see Query#iterate()
+ */
+ public static void close(Iterator iterator) throws HibernateException {
+ if ( iterator instanceof HibernateIterator ) {
+ ( ( HibernateIterator ) iterator ).close();
+ }
+ else {
+ throw new IllegalArgumentException( "not a Hibernate iterator" );
+ }
+ }
+
+ /**
+ * Check if the property is initialized. If the named property does not exist
+ * or is not persistent, this method always returns <tt>true</tt>.
+ *
+ * @param proxy The potential proxy
+ * @param propertyName the name of a persistent attribute of the object
+ * @return true if the named property of the object is not listed as uninitialized
+ * @return false if the object is an uninitialized proxy, or the named property is uninitialized
+ */
+ public static boolean isPropertyInitialized(Object proxy, String propertyName) {
+
+ Object entity;
+ if ( proxy instanceof HibernateProxy ) {
+ LazyInitializer li = ( ( HibernateProxy ) proxy ).getHibernateLazyInitializer();
+ if ( li.isUninitialized() ) {
+ return false;
+ }
+ else {
+ entity = li.getImplementation();
+ }
+ }
+ else {
+ entity = proxy;
+ }
+
+ if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
+ FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
+ return interceptor == null || interceptor.isInitialized( propertyName );
+ }
+ else {
+ return true;
+ }
+
+ }
+
+}
/src/org/hibernate/Hibernate.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/SessionException.java
===================================================================
--- src/org/hibernate/SessionException.java (revision 0)
+++ src/org/hibernate/SessionException.java (revision 33)
@@ -0,0 +1,45 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Thrown when the user calls a method of a {@link Session} that is in an
+ * inappropropriate state for the given call (for example, the the session
+ * is closed or disconnected).
+ *
+ * @author Gavin King
+ */
+public class SessionException extends HibernateException {
+
+ /**
+ * Constructs a new SessionException with the given message.
+ *
+ * @param message The message indicating the specific problem.
+ */
+ public SessionException(String message) {
+ super( message );
+ }
+
+}
/src/org/hibernate/SessionException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/Criteria.java
===================================================================
--- src/org/hibernate/Criteria.java (revision 0)
+++ src/org/hibernate/Criteria.java (revision 33)
@@ -0,0 +1,361 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+import java.util.List;
+
+import org.hibernate.criterion.CriteriaSpecification;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Projection;
+import org.hibernate.transform.ResultTransformer;
+
+/**
+ * <tt>Criteria</tt> is a simplified API for retrieving entities
+ * by composing <tt>Criterion</tt> objects. This is a very
+ * convenient approach for functionality like "search" screens
+ * where there is a variable number of conditions to be placed
+ * upon the result set.<br>
+ * <br>
+ * The <tt>Session</tt> is a factory for <tt>Criteria</tt>.
+ * <tt>Criterion</tt> instances are usually obtained via
+ * the factory methods on <tt>Restrictions</tt>. eg.
+ * <pre>
+ * List cats = session.createCriteria(Cat.class)
+ * .add( Restrictions.like("name", "Iz%") )
+ * .add( Restrictions.gt( "weight", new Float(minWeight) ) )
+ * .addOrder( Order.asc("age") )
+ * .list();
+ * </pre>
+ * You may navigate associations using <tt>createAlias()</tt> or
+ * <tt>createCriteria()</tt>.
+ * <pre>
+ * List cats = session.createCriteria(Cat.class)
+ * .createCriteria("kittens")
+ * .add( Restrictions.like("name", "Iz%") )
+ * .list();
+ * </pre>
+ * <pre>
+ * List cats = session.createCriteria(Cat.class)
+ * .createAlias("kittens", "kit")
+ * .add( Restrictions.like("kit.name", "Iz%") )
+ * .list();
+ * </pre>
+ * You may specify projection and aggregation using <tt>Projection</tt>
+ * instances obtained via the factory methods on <tt>Projections</tt>.
+ * <pre>
+ * List cats = session.createCriteria(Cat.class)
+ * .setProjection( Projections.projectionList()
+ * .add( Projections.rowCount() )
+ * .add( Projections.avg("weight") )
+ * .add( Projections.max("weight") )
+ * .add( Projections.min("weight") )
+ * .add( Projections.groupProperty("color") )
+ * )
+ * .addOrder( Order.asc("color") )
+ * .list();
+ * </pre>
+ *
+ * @see Session#createCriteria(java.lang.Class)
+ * @see org.hibernate.criterion.Restrictions
+ * @see org.hibernate.criterion.Projections
+ * @see org.hibernate.criterion.Order
+ * @see org.hibernate.criterion.Criterion
+ * @see org.hibernate.criterion.Projection
+ * @see org.hibernate.criterion.DetachedCriteria a disconnected version of this API
+ * @author Gavin King
+ */
+public interface Criteria extends CriteriaSpecification {
+
+ /**
+ * Get the alias of the entity encapsulated by this criteria instance.
+ *
+ * @return The alias for the encapsulated entity.
+ */
+ public String getAlias();
+
+ /**
+ * Used to specify that the query results will be a projection (scalar in
+ * nature). Implicitly specifies the {@link #PROJECTION} result transformer.
+ * <p/>
+ * The individual components contained within the given
+ * {@link Projection projection} determines the overall "shape" of the
+ * query result.
+ *
+ * @param projection The projection representing the overall "shape" of the
+ * query results.
+ * @return this (for method chaining)
+ */
+ public Criteria setProjection(Projection projection);
+
+ /**
+ * Add a {@link Criterion restriction} to constrain the results to be
+ * retrieved.
+ *
+ * @param criterion The {@link Criterion criterion} object representing the
+ * restriction to be applied.
+ * @return this (for method chaining)
+ */
+ public Criteria add(Criterion criterion);
+
+ /**
+ * Add an {@link Order ordering} to the result set.
+ *
+ * @param order The {@link Order order} object representing an ordering
+ * to be applied to the results.
+ * @return this (for method chaining)
+ */
+ public Criteria addOrder(Order order);
+
+ /**
+ * Specify an association fetching strategy for an association or a
+ * collection of values.
+ *
+ * @param associationPath a dot seperated property path
+ * @param mode The fetch mode for the referenced association
+ * @return this (for method chaining)
+ */
+ public Criteria setFetchMode(String associationPath, FetchMode mode) throws HibernateException;
+
+ /**
+ * Set the lock mode of the current entity
+ *
+ * @param lockMode The lock mode to be applied
+ * @return this (for method chaining)
+ */
+ public Criteria setLockMode(LockMode lockMode);
+
+ /**
+ * Set the lock mode of the aliased entity
+ *
+ * @param alias The previously assigned alias representing the entity to
+ * which the given lock mode should apply.
+ * @param lockMode The lock mode to be applied
+ * @return this (for method chaining)
+ */
+ public Criteria setLockMode(String alias, LockMode lockMode);
+
+ /**
+ * Join an association, assigning an alias to the joined association.
+ * <p/>
+ * Functionally equivalent to {@link #createAlias(String, String, int)} using
+ * {@link #INNER_JOIN} for the joinType.
+ *
+ * @param associationPath A dot-seperated property path
+ * @param alias The alias to assign to the joined association (for later reference).
+ * @return this (for method chaining)
+ */
+ public Criteria createAlias(String associationPath, String alias) throws HibernateException;
+
+ /**
+ * Join an association using the specified join-type, assigning an alias
+ * to the joined association.
+ * <p/>
+ * The joinType is expected to be one of {@link #INNER_JOIN} (the default),
+ * {@link #FULL_JOIN}, or {@link #LEFT_JOIN}.
+ *
+ * @param associationPath A dot-seperated property path
+ * @param alias The alias to assign to the joined association (for later reference).
+ * @param joinType The type of join to use.
+ * @return this (for method chaining)
+ */
+ public Criteria createAlias(String associationPath, String alias, int joinType) throws HibernateException;
+
+ /**
+ * Create a new <tt>Criteria</tt>, "rooted" at the associated entity.
+ * <p/>
+ * Functionally equivalent to {@link #createCriteria(String, int)} using
+ * {@link #INNER_JOIN} for the joinType.
+ *
+ * @param associationPath A dot-seperated property path
+ * @return the created "sub criteria"
+ */
+ public Criteria createCriteria(String associationPath) throws HibernateException;
+
+ /**
+ * Create a new <tt>Criteria</tt>, "rooted" at the associated entity, using the
+ * specified join type.
+ *
+ * @param associationPath A dot-seperated property path
+ * @param joinType The type of join to use.
+ * @return the created "sub criteria"
+ */
+ public Criteria createCriteria(String associationPath, int joinType) throws HibernateException;
+
+ /**
+ * Create a new <tt>Criteria</tt>, "rooted" at the associated entity,
+ * assigning the given alias.
+ * <p/>
+ * Functionally equivalent to {@link #createCriteria(String, String, int)} using
+ * {@link #INNER_JOIN} for the joinType.
+ *
+ * @param associationPath A dot-seperated property path
+ * @param alias The alias to assign to the joined association (for later reference).
+ * @return the created "sub criteria"
+ */
+ public Criteria createCriteria(String associationPath, String alias) throws HibernateException;
+
+ /**
+ * Create a new <tt>Criteria</tt>, "rooted" at the associated entity,
+ * assigning the given alias and using the specified join type.
+ *
+ * @param associationPath A dot-seperated property path
+ * @param alias The alias to assign to the joined association (for later reference).
+ * @param joinType The type of join to use.
+ * @return the created "sub criteria"
+ */
+ public Criteria createCriteria(String associationPath, String alias, int joinType) throws HibernateException;
+
+ /**
+ * Set a strategy for handling the query results. This determines the
+ * "shape" of the query result.
+ *
+ * @param resultTransformer The transformer to apply
+ * @return this (for method chaining)
+ *
+ * @see #ROOT_ENTITY
+ * @see #DISTINCT_ROOT_ENTITY
+ * @see #ALIAS_TO_ENTITY_MAP
+ * @see #PROJECTION
+ */
+ public Criteria setResultTransformer(ResultTransformer resultTransformer);
+
+ /**
+ * Set a limit upon the number of objects to be retrieved.
+ *
+ * @param maxResults the maximum number of results
+ * @return this (for method chaining)
+ */
+ public Criteria setMaxResults(int maxResults);
+
+ /**
+ * Set the first result to be retrieved.
+ *
+ * @param firstResult the first result to retrieve, numbered from <tt>0</tt>
+ * @return this (for method chaining)
+ */
+ public Criteria setFirstResult(int firstResult);
+
+ /**
+ * Set a fetch size for the underlying JDBC query.
+ *
+ * @param fetchSize the fetch size
+ * @return this (for method chaining)
+ *
+ * @see java.sql.Statement#setFetchSize
+ */
+ public Criteria setFetchSize(int fetchSize);
+
+ /**
+ * Set a timeout for the underlying JDBC query.
+ *
+ * @param timeout The timeout value to apply.
+ * @return this (for method chaining)
+ *
+ * @see java.sql.Statement#setQueryTimeout
+ */
+ public Criteria setTimeout(int timeout);
+
+ /**
+ * Enable caching of this query result, provided query caching is enabled
+ * for the underlying session factory.
+ *
+ * @param cacheable Should the result be considered cacheable; default is
+ * to not cache (false).
+ * @return this (for method chaining)
+ */
+ public Criteria setCacheable(boolean cacheable);
+
+ /**
+ * Set the name of the cache region to use for query result caching.
+ *
+ * @param cacheRegion the name of a query cache region, or <tt>null</tt>
+ * for the default query cache
+ * @return this (for method chaining)
+ *
+ * @see #setCacheable
+ */
+ public Criteria setCacheRegion(String cacheRegion);
+
+ /**
+ * Add a comment to the generated SQL.
+ *
+ * @param comment a human-readable string
+ * @return this (for method chaining)
+ */
+ public Criteria setComment(String comment);
+
+ /**
+ * Override the flush mode for this particular query.
+ *
+ * @param flushMode The flush mode to use.
+ * @return this (for method chaining)
+ */
+ public Criteria setFlushMode(FlushMode flushMode);
+
+ /**
+ * Override the cache mode for this particular query.
+ *
+ * @param cacheMode The cache mode to use.
+ * @return this (for method chaining)
+ */
+ public Criteria setCacheMode(CacheMode cacheMode);
+
+ /**
+ * Get the results.
+ *
+ * @return The list of matched query results.
+ */
+ public List list() throws HibernateException;
+
+ /**
+ * Get the results as an instance of {@link ScrollableResults}
+ *
+ * @return The {@link ScrollableResults} representing the matched
+ * query results.
+ */
+ public ScrollableResults scroll() throws HibernateException;
+
+ /**
+ * Get the results as an instance of {@link ScrollableResults} based on the
+ * given scroll mode.
+ *
+ * @param scrollMode Indicates the type of underlying database cursor to
+ * request.
+ * @return The {@link ScrollableResults} representing the matched
+ * query results.
+ */
+ public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException;
+
+ /**
+ * Convenience method to return a single instance that matches
+ * the query, or null if the query returns no results.
+ *
+ * @return the single result or <tt>null</tt>
+ * @throws HibernateException if there is more than one matching result
+ */
+ public Object uniqueResult() throws HibernateException;
+
+}
\ No newline at end of file
/src/org/hibernate/Criteria.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/org/hibernate/TransactionException.java
===================================================================
--- src/org/hibernate/TransactionException.java (revision 0)
+++ src/org/hibernate/TransactionException.java (revision 33)
@@ -0,0 +1,45 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate;
+
+/**
+ * Indicates that a transaction could not be begun, committed
+ * or rolled back.
+ *
+ * @see Transaction
+ * @author Anton van Straaten
+ */
+
+public class TransactionException extends HibernateException {
+
+ public TransactionException(String message, Throwable root) {
+ super(message,root);
+ }
+
+ public TransactionException(String message) {
+ super(message);
+ }
+
+}
/src/org/hibernate/TransactionException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/SecondaryTables.java
===================================================================
--- src/javax/persistence/SecondaryTables.java (revision 0)
+++ src/javax/persistence/SecondaryTables.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id: SecondaryTables.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+/**
+ * This annotation is used to specify multiple secondary tables for an entity.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface SecondaryTables {
+ /**
+ * The secondary tables for an entity.
+ */
+ SecondaryTable[] value();
+}
/src/javax/persistence/SecondaryTables.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Temporal.java
===================================================================
--- src/javax/persistence/Temporal.java (revision 0)
+++ src/javax/persistence/Temporal.java (revision 33)
@@ -0,0 +1,26 @@
+//$Id: Temporal.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+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();
+}
/src/javax/persistence/Temporal.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Persistence.java
===================================================================
--- src/javax/persistence/Persistence.java (revision 0)
+++ src/javax/persistence/Persistence.java (revision 33)
@@ -0,0 +1,111 @@
+// $Id: Persistence.java 14134 2007-10-25 22:34:46Z epbernard $
+package javax.persistence;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.persistence.spi.PersistenceProvider;
+
+/**
+ * Bootstrap class that provides access to an EntityManagerFactory.
+ */
+public class Persistence {
+
+ //typo intended because it leaked into the JPA 1 spec. Do not use this constant.
+ public static final java.lang.String PERSISTENCE_PROVIDER = "javax.persistence.spi.PeristenceProvider";
+
+ protected static final Set<PersistenceProvider> providers = new HashSet<PersistenceProvider>();
+
+ /**
+ * Create and return an EntityManagerFactory for the named persistence unit.
+ *
+ * @param persistenceUnitName The name of the persistence unit
+ * @return The factory that creates EntityManagers configured according to the specified persistence unit
+ */
+ public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName) {
+ return createEntityManagerFactory( persistenceUnitName, null );
+ }
+
+ /**
+ * Create and return an EntityManagerFactory for the named persistence unit using the given properties.
+ *
+ * @param persistenceUnitName The name of the persistence unit
+ * @param properties Additional properties to use when creating the factory. The values of these properties override
+ * any values that may have been configured elsewhere
+ * @return The factory that creates EntityManagers configured according to the specified persistence unit
+ */
+ public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties) {
+ EntityManagerFactory emf = null;
+
+ if ( providers.size() == 0 ) {
+ findAllProviders();
+ }
+ for ( PersistenceProvider provider : providers ) {
+ emf = provider.createEntityManagerFactory( persistenceUnitName, properties );
+ if ( emf != null ) break;
+ }
+ if ( emf == null ) {
+ throw new PersistenceException( "No Persistence provider for EntityManager named " + persistenceUnitName );
+ }
+ return emf;
+ }
+
+ // Helper methods
+
+ private static void findAllProviders() {
+ try {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ Enumeration<URL> resources = loader.getResources( "META-INF/services/" + PersistenceProvider.class.getName() );
+ Set<String> names = new HashSet<String>();
+ while ( resources.hasMoreElements() ) {
+ URL url = resources.nextElement();
+ InputStream is = url.openStream();
+ try {
+ names.addAll( providerNamesFromReader( new BufferedReader( new InputStreamReader( is ) ) ) );
+ }
+ finally {
+ is.close();
+ }
+ }
+ for ( String s : names ) {
+ Class providerClass = loader.loadClass( s );
+ providers.add( (PersistenceProvider) providerClass.newInstance() );
+ }
+ }
+ catch (IOException e) {
+ throw new PersistenceException( e );
+ }
+ catch (InstantiationException e) {
+ throw new PersistenceException( e );
+ }
+ catch (IllegalAccessException e) {
+ throw new PersistenceException( e );
+ }
+ catch (ClassNotFoundException e) {
+ throw new PersistenceException( e );
+ }
+ }
+
+ private static final Pattern nonCommentPattern = Pattern.compile( "^([^#]+)" );
+
+ private static Set<String> providerNamesFromReader(BufferedReader reader) throws IOException {
+ Set<String> names = new HashSet<String>();
+ String line;
+ while ( ( line = reader.readLine() ) != null ) {
+ line = line.trim();
+ Matcher m = nonCommentPattern.matcher( line );
+ if ( m.find() ) {
+ names.add( m.group().trim() );
+ }
+ }
+ return names;
+ }
+}
/src/javax/persistence/Persistence.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PostLoad.java
===================================================================
--- src/javax/persistence/PostLoad.java (revision 0)
+++ src/javax/persistence/PostLoad.java (revision 33)
@@ -0,0 +1,24 @@
+/* $Id: PostLoad.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 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 {
+}
/src/javax/persistence/PostLoad.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/DiscriminatorColumn.java
===================================================================
--- src/javax/persistence/DiscriminatorColumn.java (revision 0)
+++ src/javax/persistence/DiscriminatorColumn.java (revision 33)
@@ -0,0 +1,47 @@
+//$Id: DiscriminatorColumn.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static javax.persistence.DiscriminatorType.STRING;
+
+/**
+ * Is used to define the discriminator column for the SINGLE_TABLE and JOINED inheritance
+ * mapping strategies.
+ *
+ * The strategy and the discriminator column are only specified in the root of an entity
+ * class hierarchy or subhierarchy in which a different inheritance strategy is applied
+ *
+ * If the DiscriminatorColumn annotation is missing, and a discriminator column is required,
+ * the name of the discriminator column defaults to "DTYPE" and the discriminator type to
+ * DiscriminatorType.STRING.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface DiscriminatorColumn {
+ /**
+ * The name of column to be used for the discriminator.
+ */
+ String name() default "DTYPE";
+ /**
+ * The type of object/column to use as a class discriminator.
+ * Defaults to DiscriminatorType.STRING
+ */
+ DiscriminatorType discriminatorType() default STRING;
+ /**
+ * The SQL fragment that is used when generating the DDL for the discriminator column.
+ * Defaults to the provider-generated SQL to create a column of the specified
+ * discriminator type.
+ */
+ String columnDefinition() default "";
+ /**
+ * The column length for String-based discriminator types. Ignored for other
+ * discriminator types.
+ */
+ int length() default 31;
+}
/src/javax/persistence/DiscriminatorColumn.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/MapKey.java
===================================================================
--- src/javax/persistence/MapKey.java (revision 0)
+++ src/javax/persistence/MapKey.java (revision 33)
@@ -0,0 +1,25 @@
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+
+/**
+ * Is used to specify the map key for associations of type Map.
+ * If a persistent field or property other than the primary key is used as a map key then it
+ * is expected to have a uniqueness constraint associated with it.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface MapKey {
+ /**
+ * The name of the persistent field or property of the associated entity that is used as the map key.
+ * If the name element is not specified, the primary key of the associated entity is used as the map key.
+ * If the primary key is a composite primary key and is mapped as IdClass, an instance of the primary key
+ * class is used as the key.
+ */
+ String name() default "";
+}
/src/javax/persistence/MapKey.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PostUpdate.java
===================================================================
--- src/javax/persistence/PostUpdate.java (revision 0)
+++ src/javax/persistence/PostUpdate.java (revision 33)
@@ -0,0 +1,25 @@
+/* $Id: PostUpdate.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 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 {
+}
/src/javax/persistence/PostUpdate.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Enumerated.java
===================================================================
--- src/javax/persistence/Enumerated.java (revision 0)
+++ src/javax/persistence/Enumerated.java (revision 33)
@@ -0,0 +1,24 @@
+//$Id: Enumerated.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+import static javax.persistence.EnumType.*;
+
+/**
+ * Specifies that a persistent property or field should be persisted as a enumerated type.
+ * It may be used in conjunction with the Basic annotation.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Enumerated {
+ /**
+ * The type used in mapping an enum type
+ */
+ EnumType value() default ORDINAL;
+}
/src/javax/persistence/Enumerated.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/NamedNativeQueries.java
===================================================================
--- src/javax/persistence/NamedNativeQueries.java (revision 0)
+++ src/javax/persistence/NamedNativeQueries.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id: NamedNativeQueries.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Is used to specify an array of native SQL named queries. Query names are scoped to the persistence unit
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface NamedNativeQueries {
+ /**
+ * Array of native SQL named queries
+ */
+ NamedNativeQuery [] value ();
+}
/src/javax/persistence/NamedNativeQueries.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PersistenceContextType.java
===================================================================
--- src/javax/persistence/PersistenceContextType.java (revision 0)
+++ src/javax/persistence/PersistenceContextType.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: PersistenceContextType.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Specifies whether a transaction-scoped or extended persistence context is to be used in
+ * PersistenceContext. If the type element is not specified, a transaction-scoped persistence
+ * context is used.
+ */
+public enum PersistenceContextType {
+ /**
+ * Transaction-scoped persistence context
+ */
+ TRANSACTION,
+ /**
+ * Extended persistence context
+ */
+ EXTENDED
+}
/src/javax/persistence/PersistenceContextType.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/FetchType.java
===================================================================
--- src/javax/persistence/FetchType.java (revision 0)
+++ src/javax/persistence/FetchType.java (revision 33)
@@ -0,0 +1,24 @@
+//$Id: FetchType.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+/**
+ * Defines strategies for fetching data from the database.
+ * The EAGER strategy is a requirement on the persistence provider runtime that data must
+ * be eagerly fetched. The LAZY strategy is a hint to the persistence provider runtime that
+ * data should be fetched lazily when it is first accessed. The implementation is permitted to
+ * eagerly fetch data for which the LAZY strategy hint has been specified. In particular, lazy
+ * fetching might only be available for Basic mappings for which property-based access is used.
+ *
+ * @author Emmanuel Bernard
+ */
+public enum FetchType {
+ /**
+ * Defines that data must be lazily fetched
+ */
+ LAZY,
+ /**
+ * Defines that data must be eagerly fetched
+ */
+ EAGER
+};
/src/javax/persistence/FetchType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/ColumnResult.java
===================================================================
--- src/javax/persistence/ColumnResult.java (revision 0)
+++ src/javax/persistence/ColumnResult.java (revision 33)
@@ -0,0 +1,22 @@
+//$Id: ColumnResult.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * References name of a column in the SELECT clause of a SQL query - i.e.,
+ * column alias, if applicable. Scalar result types can be included in the query
+ * result by specifying this annotation in the metadata.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({}) @Retention(RetentionPolicy.RUNTIME)
+public @interface ColumnResult {
+ /**
+ * The name of a column in the SELECT clause of a SQL query
+ */
+ String name();
+}
\ No newline at end of file
/src/javax/persistence/ColumnResult.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PostPersist.java
===================================================================
--- src/javax/persistence/PostPersist.java (revision 0)
+++ src/javax/persistence/PostPersist.java (revision 33)
@@ -0,0 +1,25 @@
+/* $Id: PostPersist.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 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 {
+}
/src/javax/persistence/PostPersist.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PersistenceException.java
===================================================================
--- src/javax/persistence/PersistenceException.java (revision 0)
+++ src/javax/persistence/PersistenceException.java (revision 33)
@@ -0,0 +1,50 @@
+/* $Id: PersistenceException.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss, Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package javax.persistence;
+
+/**
+ * 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>
+ */
+public class PersistenceException extends RuntimeException {
+ /**
+ * Constructs a new PersistenceException exception with null as its detail message.
+ */
+ public PersistenceException() {
+ }
+
+ /**
+ * Constructs a new PersistenceException exception with the specified detail message.
+ *
+ * @param message the detail message
+ */
+ public PersistenceException(String message) {
+ super( message );
+ }
+
+ /**
+ * 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 );
+ }
+
+ /**
+ * Constructs a new PersistenceException exception with the specified cause
+ *
+ * @param cause the cause
+ */
+ public PersistenceException(Throwable cause) {
+ super( cause );
+ }
+}
/src/javax/persistence/PersistenceException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EntityListeners.java
===================================================================
--- src/javax/persistence/EntityListeners.java (revision 0)
+++ src/javax/persistence/EntityListeners.java (revision 33)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * Specifies the callback listener classes to be used for an entity or mapped superclass.
+ * This annotation may be applied to an entity class or mapped superclass.
+ *
+ * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EntityListeners {
+ /**
+ * The callback listener classes
+ */
+ Class[] value();
+}
/src/javax/persistence/EntityListeners.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EmbeddedId.java
===================================================================
--- src/javax/persistence/EmbeddedId.java (revision 0)
+++ src/javax/persistence/EmbeddedId.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: EmbeddedId.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Is applied to a persistent field or property of an entity class or mapped superclass to denote
+ * a composite primary key that is an embeddable class. The embeddable class must be annotated
+ * as Embeddable.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EmbeddedId {}
/src/javax/persistence/EmbeddedId.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EntityManager.java
===================================================================
--- src/javax/persistence/EntityManager.java (revision 0)
+++ src/javax/persistence/EntityManager.java (revision 33)
@@ -0,0 +1,298 @@
+// $Id: EntityManager.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Interface used to interact with the persistence context.
+ *
+ * An EntityManager instance is associated with a persistence context. A persistence context is a set of
+ * entity instances in which for any persistent entity identity there is a unique entity instance.
+ * Within the persistence context, the entity instances and their lifecycle are managed. This interface
+ * defines the methods that are used to interact with the persistence context. The EntityManager API is
+ * used to create and remove persistent entity instances, to find entities by their primary key, and to
+ * query over entities.
+ *
+ * The set of entities that can be managed by a given EntityManager instance is defined by a persistence unit.
+ * A persistence unit defines the set of all classes that are related or grouped by the application, and
+ * which must be colocated in their mapping to a single database.
+ *
+ * @author Emmanuel Bernard
+ */
+public interface EntityManager {
+ /**
+ * Make an entity instance managed and persistent.
+ *
+ * @param entity
+ * @throws EntityExistsException if the entity already exists.
+ * (The EntityExistsException may be thrown when the persist
+ * operation is invoked, or the EntityExistsException or
+ * another PersistenceException may be thrown at commit
+ * time.)
+ * @throws IllegalStateException if this EntityManager has been closed.
+ * @throws IllegalArgumentException if not an entity
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ */
+ public void persist(Object entity);
+
+ /**
+ * Merge the state of the given entity into the
+ * current persistence context.
+ *
+ * @param entity
+ * @return the instance that the state was merged to
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if instance is not an
+ * entity or is a removed entity
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ */
+ public <T> T merge(T entity);
+
+ /**
+ * Remove the entity instance.
+ *
+ * @param entity
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if not an entity
+ * or if a detached entity
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ */
+ public void remove(Object entity);
+
+ /**
+ * Find by primary key.
+ *
+ * @param entityClass
+ * @param primaryKey
+ * @return the found entity instance or null
+ * if the entity does not exist
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if the first argument does
+ * not denote an entity type or the second
+ * argument is not a valid type for that
+ * entity’s primary key
+ */
+ public <T> T find(Class<T> entityClass, Object primaryKey);
+
+ /**
+ * Get an instance, whose state may be lazily fetched.
+ * If the requested instance does not exist in the database,
+ * the EntityNotFoundException is thrown when the instance
+ * state is first accessed. (The persistence provider runtime is
+ * permitted to throw the EntityNotFoundException when
+ * getReference is called.)
+ * The application should not expect that the instance state will
+ * be available upon detachment, unless it was accessed by the
+ * application while the entity manager was open.
+ *
+ * @param entityClass
+ * @param primaryKey
+ * @return the found entity instance
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if the first argument does
+ * not denote an entity type or the second
+ * argument is not a valid type for that
+ * entity’s primary key
+ * @throws EntityNotFoundException if the entity state
+ * cannot be accessed
+ */
+ public <T> T getReference(Class<T> entityClass, Object primaryKey);
+
+ /**
+ * Synchronize the persistence context to the
+ * underlying database.
+ *
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws TransactionRequiredException if there is
+ * no transaction
+ * @throws PersistenceException if the flush fails
+ */
+ public void flush();
+
+ /**
+ * Set the flush mode that applies to all objects contained
+ * in the persistence context.
+ *
+ * @param flushMode
+ * @throws IllegalStateException if this EntityManager has been closed
+ */
+ public void setFlushMode(FlushModeType flushMode);
+
+ /**
+ * Get the flush mode that applies to all objects contained
+ * in the persistence context.
+ *
+ * @return flushMode
+ * @throws IllegalStateException if this EntityManager has been closed
+ */
+ public FlushModeType getFlushMode();
+
+ /**
+ * Set the lock mode for an entity object contained
+ * in the persistence context.
+ *
+ * @param entity
+ * @param lockMode
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws PersistenceException if an unsupported lock call
+ * is made
+ * @throws IllegalArgumentException if the instance is not
+ * an entity or is a detached entity
+ * @throws TransactionRequiredException if there is no
+ * transaction
+ */
+ public void lock(Object entity, LockModeType lockMode);
+
+ /**
+ * Refresh the state of the instance from the database,
+ * overwriting changes made to the entity, if any.
+ *
+ * @param entity
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if not an entity
+ * or entity is not managed
+ * @throws TransactionRequiredException if invoked on a
+ * container-managed entity manager of type
+ * PersistenceContextType.TRANSACTION and there is
+ * no transaction.
+ * @throws EntityNotFoundException if the entity no longer
+ * exists in the database
+ */
+ public void refresh(Object entity);
+
+ /**
+ * Clear the persistence context, causing all managed
+ * entities to become detached. Changes made to entities that
+ * have not been flushed to the database will not be
+ * persisted.
+ *
+ * @throws IllegalStateException if this EntityManager has been closed
+ */
+ public void clear();
+
+ /**
+ * Check if the instance belongs to the current persistence
+ * context.
+ *
+ * @param entity
+ * @return <code>true</code> if the instance belongs to the current persistence context.
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if not an entity
+ */
+ public boolean contains(Object entity);
+
+ /**
+ * Create an instance of Query for executing an
+ * EJB QL statement.
+ *
+ * @param ejbqlString an EJB QL query string
+ * @return the new query instance
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if query string is not valid
+ */
+ public Query createQuery(String ejbqlString);
+
+ /**
+ * Create an instance of Query for executing a
+ * named query (in EJB QL or native SQL).
+ *
+ * @param name the name of a query defined in metadata
+ * @return the new query instance
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws IllegalArgumentException if a query has not been
+ * defined with the given name
+ */
+ public Query createNamedQuery(String name);
+
+ /**
+ * Create an instance of Query for executing
+ * a native SQL statement, e.g., for update or delete.
+ *
+ * @param sqlString a native SQL query string
+ * @return the new query instance
+ * @throws IllegalStateException if this EntityManager has been closed
+ */
+ public Query createNativeQuery(String sqlString);
+
+ /**
+ * Create an instance of Query for executing
+ * a native SQL query.
+ *
+ * @param sqlString a native SQL query string
+ * @param resultClass the class of the resulting instance(s)
+ * @return the new query instance
+ * @throws IllegalStateException if this EntityManager has been closed
+ */
+ public Query createNativeQuery(String sqlString, Class resultClass);
+
+ /**
+ * Create an instance of Query for executing
+ * a native SQL query.
+ *
+ * @param sqlString a native SQL query string
+ * @param resultSetMapping the name of the result set mapping
+ * @return the new query instance
+ * @throws IllegalStateException if this EntityManager has been closed
+ */
+ public Query createNativeQuery(String sqlString, String resultSetMapping);
+
+ /**
+ * Indicate to the EntityManager that a JTA transaction is
+ * active. This method should be called on a JTA application
+ * managed EntityManager that was created outside the scope
+ * of the active transaction to associate it with the current
+ * JTA transaction.
+ *
+ * @throws IllegalStateException if this EntityManager has been closed
+ * @throws TransactionRequiredException if there is
+ * no transaction.
+ */
+ public void joinTransaction();
+
+ /**
+ * Return the underlying provider object for the EntityManager, if available.
+ * The result of this method is implementation specific
+ *
+ * @throws IllegalStateException if this EntityManager has been closed
+ */
+ public Object getDelegate();
+
+ /**
+ * Close an application-managed EntityManager.
+ * After the close method has been invoked, all methods
+ * on the EntityManager instance and any Query objects obtained
+ * from it will throw the IllegalStateException except
+ * for getTransaction and isOpen (which will return false).
+ * If this method is called when the EntityManager is
+ * associated with an active transaction, the persistence
+ * context remains managed until the transaction completes.
+ *
+ * @throws IllegalStateException if the EntityManager is container-managed or has been already closed
+ */
+ public void close();
+
+ /**
+ * Determine whether the EntityManager is open.
+ *
+ * @return true until the EntityManager has been closed.
+ */
+ public boolean isOpen();
+
+ /**
+ * Return the resource-level transaction object.
+ * The EntityTransaction instance may be used serially to
+ * begin and commit multiple transactions.
+ *
+ * @return EntityTransaction instance
+ * @throws IllegalStateException if invoked on a JTA
+ * EntityManager.
+ */
+ public EntityTransaction getTransaction();
+}
\ No newline at end of file
/src/javax/persistence/EntityManager.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/RollbackException.java
===================================================================
--- src/javax/persistence/RollbackException.java (revision 0)
+++ src/javax/persistence/RollbackException.java (revision 33)
@@ -0,0 +1,44 @@
+//$Id: $
+package javax.persistence;
+
+/**
+ * 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 );
+ }
+}
/src/javax/persistence/RollbackException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/OneToMany.java
===================================================================
--- src/javax/persistence/OneToMany.java (revision 0)
+++ src/javax/persistence/OneToMany.java (revision 33)
@@ -0,0 +1,47 @@
+//$Id: OneToMany.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static javax.persistence.FetchType.*;
+
+/**
+ * Defines a many-valued association with one-to-many multiplicity.
+ *
+ * If the collection is defined using generics to specify the element type,
+ * the associated target entity type need not be specified; otherwise the target
+ * entity class must be specified.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface OneToMany {
+ /**
+ * The entity class that is the target of the association. Optional only if the collection
+ * property is defined using Java generics. Must be specified otherwise.
+ *
+ * Defaults to the parameterized type of the collection when defined using generics.
+ */
+ Class targetEntity() default void.class;
+ /**
+ * The operations that must be cascaded to the target of the association.
+ *
+ * Defaults to no operations being cascaded.
+ */
+ CascadeType[] cascade() default {};
+ /**
+ * Whether the association should be lazily loaded or must be eagerly fetched.
+ * The EAGER strategy is a requirement on the persistenceprovider runtime that the
+ * associatedentities must be eagerly fetched. The LAZY strategy is a hint to the
+ * persistence provider runtime.
+ */
+ FetchType fetch() default LAZY;
+ /**
+ * The field that owns the relationship. Required unless the relationship is unidirectional.
+ */
+ String mappedBy() default "";
+}
/src/javax/persistence/OneToMany.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/MappedSuperclass.java
===================================================================
--- src/javax/persistence/MappedSuperclass.java (revision 0)
+++ src/javax/persistence/MappedSuperclass.java (revision 33)
@@ -0,0 +1,25 @@
+//$Id: MappedSuperclass.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Designates a class whose mapping information is applied to the entities that inherit
+ * from it. A mapped superclass has no separate table defined for it.
+ *
+ * A class designated with the MappedSuperclass annotation can be mapped in the same way as
+ * an entity except that the mappings will apply only to its subclasses since no table exists
+ * for the mapped superclass itself. When applied to the subclasses the inherited mappings will
+ * apply in the context of the subclass tables. Mapping information may be overridden in such
+ * subclasses by using the AttributeOverride and AssociationOverride annotations or corresponding *
+ * XML elements.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target(TYPE) @Retention(RUNTIME)
+public @interface MappedSuperclass {}
/src/javax/persistence/MappedSuperclass.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/UniqueConstraint.java
===================================================================
--- src/javax/persistence/UniqueConstraint.java (revision 0)
+++ src/javax/persistence/UniqueConstraint.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id: UniqueConstraint.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation is used to specify that a unique constraint is to be included in the generated DDL
+ * for a primary or secondary table
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({}) @Retention(RUNTIME)
+public @interface UniqueConstraint {
+ /**
+ * An array of the column names that make up the constraint
+ */
+ String[] columnNames();
+}
/src/javax/persistence/UniqueConstraint.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/AssociationOverride.java
===================================================================
--- src/javax/persistence/AssociationOverride.java (revision 0)
+++ src/javax/persistence/AssociationOverride.java (revision 33)
@@ -0,0 +1,34 @@
+//$Id:$
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+
+/**
+ * This annotation is used to override a many-to-one or one-to-one mapping of property or field for
+ * an entity relationship.
+ * The AssociationOverride annotation may be applied to an entity that extends a mapped superclass
+ * to override a many-to-one or one-to-one mapping defined by the mapped superclass. If the
+ * AssociationOverride annotation is not specified, the join column is mapped the same as in
+ * the original mapping.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+public @interface AssociationOverride {
+ /**
+ * The name of the relationship property whose mapping is being overridden if property-based
+ * access is being used, or the name of the relationship field if field-based access is used.
+ */
+ String name();
+
+ /**
+ * The join column that is being mapped to the persistent attribute.
+ */
+ JoinColumn[] joinColumns();
+}
/src/javax/persistence/AssociationOverride.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/OptimisticLockException.java
===================================================================
--- src/javax/persistence/OptimisticLockException.java (revision 0)
+++ src/javax/persistence/OptimisticLockException.java (revision 33)
@@ -0,0 +1,42 @@
+//$Id: $
+package javax.persistence;
+
+/**
+ * Thrown by the persistence provider when an optimistic locking conflict occurs.
+ * This exception may be thrown as part of an API call, a flush or at commit time.
+ * The current transaction, if one is active, will be marked for rollback.
+ *
+ * @author Emmanuel Bernard
+ */
+public class OptimisticLockException extends PersistenceException {
+ private Object entity;
+
+ public OptimisticLockException() {
+ super();
+ }
+
+ public OptimisticLockException(Object entity) {
+ this.entity = entity;
+ }
+
+ public OptimisticLockException(Throwable cause) {
+ super( cause );
+ }
+
+ public OptimisticLockException(String message) {
+ super( message );
+ }
+
+ public OptimisticLockException(String message, Throwable cause) {
+ super( message, cause );
+ }
+
+ public OptimisticLockException(String message, Throwable cause, Object entity) {
+ super( message, cause );
+ this.entity = entity;
+ }
+
+ public Object getEntity() {
+ return entity;
+ }
+}
/src/javax/persistence/OptimisticLockException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/IdClass.java
===================================================================
--- src/javax/persistence/IdClass.java (revision 0)
+++ src/javax/persistence/IdClass.java (revision 33)
@@ -0,0 +1,26 @@
+//$Id: IdClass.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Specifies a composite primary key class that is mapped to multiple fields or properties
+ * of the entity.
+ *
+ * The names of the fields or properties in the primary key class and the primary key fields
+ * or properties of the entity must correspond and their types must be the same.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface IdClass {
+ /**
+ * Primary key class
+ */
+ Class value();
+}
/src/javax/persistence/IdClass.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EntityTransaction.java
===================================================================
--- src/javax/persistence/EntityTransaction.java (revision 0)
+++ src/javax/persistence/EntityTransaction.java (revision 33)
@@ -0,0 +1,60 @@
+//$Id: EntityTransaction.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * The EntityTransaction interface is used to control resource transactions
+ * on resource-local entity managers. The EntityManager.getTransaction()
+ * method returns the EntityTransaction interface.
+ *
+ * @author Emmanuel Bernard
+ */
+public interface EntityTransaction {
+ /**
+ * Start a resource transaction.
+ *
+ * @throws IllegalStateException if isActive() is true.
+ */
+ public void begin();
+
+ /**
+ * Commit the current transaction, writing any unflushed
+ * changes to the database.
+ *
+ * @throws IllegalStateException if isActive() is false.
+ * @throws RollbackException if the commit fails.
+ */
+ public void commit();
+
+ /**
+ * Roll back the current transaction.
+ *
+ * @throws IllegalStateException if isActive() is false.
+ * @throws PersistenceException if an unexpected error
+ * condition is encountered.
+ */
+ public void rollback();
+
+ /**
+ * Mark the current transaction so that the only possible
+ * outcome of the transaction is for the transaction to be
+ * rolled back.
+ *
+ * @throws IllegalStateException if isActive() is false.
+ */
+ public void setRollbackOnly();
+
+ /**
+ * Determine whether the current transaction has been marked
+ * for rollback.
+ *
+ * @throws IllegalStateException if isActive() is false.
+ */
+ public boolean getRollbackOnly();
+
+ /**
+ * Indicate whether a transaction is in progress.
+ * @throws PersistenceException if an unexpected error
+ * condition is encountered.
+ */
+ public boolean isActive();
+}
\ No newline at end of file
/src/javax/persistence/EntityTransaction.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PersistenceUnit.java
===================================================================
--- src/javax/persistence/PersistenceUnit.java (revision 0)
+++ src/javax/persistence/PersistenceUnit.java (revision 33)
@@ -0,0 +1,33 @@
+/* $Id: PersistenceUnit.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Expresses a dependency on an EntityManagerFactory.
+ *
+ * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
+ */
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+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 "";
+}
/src/javax/persistence/PersistenceUnit.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/TemporalType.java
===================================================================
--- src/javax/persistence/TemporalType.java (revision 0)
+++ src/javax/persistence/TemporalType.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id: TemporalType.java 14298 2008-01-30 17:51:29Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+/**
+ * Type used to indicate a specific mapping of {@link java.util.Date} or {@link java.util.Calendar).
+ */
+public enum TemporalType {
+ /**
+ * Map as java.sql.Date
+ */
+ DATE,
+ /**
+ * Map as java.sql.Time
+ */
+ TIME,
+ /**
+ * Map as java.sql.Timestamp
+ */
+ TIMESTAMP
+}
\ No newline at end of file
/src/javax/persistence/TemporalType.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/AttributeOverrides.java
===================================================================
--- src/javax/persistence/AttributeOverrides.java (revision 0)
+++ src/javax/persistence/AttributeOverrides.java (revision 33)
@@ -0,0 +1,23 @@
+//$Id: AttributeOverrides.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+
+/**
+ * Is used to override mappings of multiple properties or fields
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+public @interface AttributeOverrides {
+ /**
+ * One or more mapping override
+ */
+ AttributeOverride[] value();
+}
/src/javax/persistence/AttributeOverrides.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/QueryHint.java
===================================================================
--- src/javax/persistence/QueryHint.java (revision 0)
+++ src/javax/persistence/QueryHint.java (revision 33)
@@ -0,0 +1,25 @@
+//$Id: QueryHint.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+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();
+}
/src/javax/persistence/QueryHint.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Inheritance.java
===================================================================
--- src/javax/persistence/Inheritance.java (revision 0)
+++ src/javax/persistence/Inheritance.java (revision 33)
@@ -0,0 +1,23 @@
+//$Id: Inheritance.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import static javax.persistence.InheritanceType.SINGLE_TABLE;
+
+/**
+ * Defines the inheritance strategy to be used for an entity class hierarchy. It is specified
+ * on the entity class that is the root of the entity class hierarchy.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface Inheritance {
+ /**
+ * The strategy to be used
+ */
+ InheritanceType strategy() default SINGLE_TABLE;
+}
/src/javax/persistence/Inheritance.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PreUpdate.java
===================================================================
--- src/javax/persistence/PreUpdate.java (revision 0)
+++ src/javax/persistence/PreUpdate.java (revision 33)
@@ -0,0 +1,25 @@
+/* $Id: PreUpdate.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 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 {
+}
/src/javax/persistence/PreUpdate.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PrimaryKeyJoinColumn.java
===================================================================
--- src/javax/persistence/PrimaryKeyJoinColumn.java (revision 0)
+++ src/javax/persistence/PrimaryKeyJoinColumn.java (revision 33)
@@ -0,0 +1,53 @@
+//$Id: PrimaryKeyJoinColumn.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+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 "";
+}
/src/javax/persistence/PrimaryKeyJoinColumn.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EntityExistsException.java
===================================================================
--- src/javax/persistence/EntityExistsException.java (revision 0)
+++ src/javax/persistence/EntityExistsException.java (revision 33)
@@ -0,0 +1,45 @@
+//$Id: $
+package javax.persistence;
+
+/**
+ * Thrown by the persistence provider when EntityManager.persist(Object) is called and the
+ * entity already exists. The current transaction, if one is active, will be marked for rollback.
+ *
+ * @author Emmanuel Bernard
+ */
+public class EntityExistsException extends PersistenceException {
+ /**
+ * Constructs a new EntityExistsException exception with null as its detail message.
+ */
+ public EntityExistsException() {
+ super();
+ }
+
+ /**
+ * Constructs a new EntityExistsException exception with the specified cause.
+ *
+ * @param cause the cause
+ */
+ public EntityExistsException(Throwable cause) {
+ super( cause );
+ }
+
+ /**
+ * Constructs a new EntityExistsException exception with the specified detail message.
+ *
+ * @param message the detail message.
+ */
+ public EntityExistsException(String message) {
+ super( message );
+ }
+
+ /**
+ * Constructs a new EntityExistsException exception with the specified detail message and cause.
+ *
+ * @param message the detail message.
+ * @param cause the cause.
+ */
+ public EntityExistsException(String message, Throwable cause) {
+ super( message, cause );
+ }
+}
/src/javax/persistence/EntityExistsException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EntityManagerFactory.java
===================================================================
--- src/javax/persistence/EntityManagerFactory.java (revision 0)
+++ src/javax/persistence/EntityManagerFactory.java (revision 33)
@@ -0,0 +1,49 @@
+//$Id: EntityManagerFactory.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import java.util.Map;
+
+/**
+ * The EntityManagerFactory interface is used by the application to obtain an
+ * application-managed entity manager. When the application has finished using
+ * the entity manager factory, and/or at application shutdown, the application
+ * should close the entity manager factory. Once an EntityManagerFactory has been
+ * closed, all its entity managers are considered to be in the closed state.
+ *
+ * @author Emmanuel Bernard
+ */
+public interface EntityManagerFactory {
+
+ /**
+ * Create a new EntityManager.
+ * This method returns a new EntityManager instance each time
+ * it is invoked.
+ * The isOpen method will return true on the returned instance.
+ */
+ EntityManager createEntityManager();
+
+ /**
+ * Create a new EntityManager with the specified Map of
+ * properties.
+ * This method returns a new EntityManager instance each time
+ * it is invoked.
+ * The isOpen method will return true on the returned instance.
+ */
+ EntityManager createEntityManager(Map map);
+
+ /**
+ * Close the factory, releasing any resources that it holds.
+ * After a factory instance is closed, all methods invoked on
+ * it will throw an IllegalStateException, except for isOpen,
+ * which will return false. Once an EntityManagerFactory has
+ * been closed, all its entity managers are considered to be
+ * in the closed state.
+ */
+ void close();
+
+ /**
+ * Indicates whether or not this factory is open. Returns
+ * true until a call to close has been made.
+ */
+ public boolean isOpen();
+}
\ No newline at end of file
/src/javax/persistence/EntityManagerFactory.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/NonUniqueResultException.java
===================================================================
--- src/javax/persistence/NonUniqueResultException.java (revision 0)
+++ src/javax/persistence/NonUniqueResultException.java (revision 33)
@@ -0,0 +1,29 @@
+//$Id: NonUniqueResultException.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Thrown by the persistence provider when getSingleResult() is executed on a query and there is more than
+ * one result from the query. This exception will not cause the current transaction, if one is active, to be
+ * marked for roll back.
+ *
+ * @author Gavin King
+ */
+public class NonUniqueResultException extends PersistenceException {
+
+ /**
+ * Constructs a new NonUniqueResultException exception with null as its detail message
+ */
+ public NonUniqueResultException() {
+ super();
+ }
+
+ /**
+ * Constructs a new NonUniqueResultException exception with the specified detail message
+ *
+ * @param message
+ */
+ public NonUniqueResultException(String message) {
+ super( message );
+ }
+
+}
/src/javax/persistence/NonUniqueResultException.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PostRemove.java
===================================================================
--- src/javax/persistence/PostRemove.java (revision 0)
+++ src/javax/persistence/PostRemove.java (revision 33)
@@ -0,0 +1,25 @@
+/* $Id: PostRemove.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 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 {
+}
/src/javax/persistence/PostRemove.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Query.java
===================================================================
--- src/javax/persistence/Query.java (revision 0)
+++ src/javax/persistence/Query.java (revision 33)
@@ -0,0 +1,148 @@
+// $Id: Query.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * Interface used to control query execution.
+ */
+public interface Query
+{
+ /**
+ * Execute the query and return the query results as a List.
+ *
+ * @return a list of the results
+ * @throws IllegalStateException f called for a Java Persistence query language UPDATE or DELETE statement
+ */
+ public List getResultList();
+
+ /**
+ * Execute a SELECT query that returns a single result.
+ *
+ * @return the result
+ * @throws NoResultException if there is no result
+ * @throws NonUniqueResultException if more than one result
+ * @throws IllegalStateException if called for a Java
+ * Persistence query language UPDATE or DELETE statement
+ */
+ public Object getSingleResult();
+
+ /**
+ * Execute an update or delete statement.
+ *
+ * @return the number of entities updated or deleted
+ * @throws IllegalStateException if called for a Java Persistence query language SELECT statement
+ * @throws TransactionRequiredException if there is no transaction
+ */
+ public int executeUpdate();
+
+ /**
+ * Set the maximum number of results to retrieve.
+ *
+ * @param maxResult
+ * @return the same query instance
+ * @throws IllegalArgumentException if argument is negative
+ */
+ public Query setMaxResults(int maxResult);
+
+ /**
+ * Set the position of the first result to retrieve.
+ *
+ * @param startPosition position of the first result, numbered from 0
+ * @return the same query instance
+ * @throws IllegalArgumentException if argument is negative
+ */
+ public Query setFirstResult(int startPosition);
+
+ /**
+ * Set an implementation-specific hint. If the hint name is not recognized, it is silently
+ * ignored.
+ *
+ * @param hintName
+ * @param value
+ * @return the same query instance
+ * @throws IllegalArgumentException if the second argument is not valid for the implementation
+ */
+ public Query setHint(String hintName, Object value);
+
+ /**
+ * Bind an argument to a named parameter.
+ *
+ * @param name the parameter name
+ * @param value
+ * @return the same query instance
+ * @throws IllegalArgumentException if parameter name does not correspond to parameter in query
+ * string or argument is of incorrect type
+ */
+ public Query setParameter(String name, Object value);
+
+ /**
+ * Bind an instance of java.util.Date to a named parameter.
+ *
+ * @param name
+ * @param value
+ * @param temporalType
+ * @return the same query instance
+ * @throws IllegalArgumentException if parameter name does not correspond to parameter in query
+ * string
+ */
+ public Query setParameter(String name, Date value, TemporalType temporalType);
+
+ /**
+ * Bind an instance of java.util.Calendar to a named parameter.
+ *
+ * @param name
+ * @param value
+ * @param temporalType
+ * @return the same query instance
+ * @throws IllegalArgumentException if parameter name does not correspond to parameter in query
+ * string
+ */
+ public Query setParameter(String name, Calendar value, TemporalType temporalType);
+
+ /**
+ * Bind an argument to a positional parameter.
+ *
+ * @param position
+ * @param value
+ * @return the same query instance
+ * @throws IllegalArgumentException if position does not correspond to positional parameter of
+ * query or argument is of incorrect type
+ */
+ public Query setParameter(int position, Object value);
+
+ /**
+ * Bind an instance of java.util.Date to a positional parameter.
+ *
+ * @param position
+ * @param value
+ * @param temporalType
+ * @return the same query instance
+ * @throws IllegalArgumentException if position does not correspond to positional parameter of
+ * query
+ */
+ public Query setParameter(int position, Date value, TemporalType temporalType);
+
+ /**
+ * Bind an instance of java.util.Calendar to a positional parameter.
+ *
+ * @param position
+ * @param value
+ * @param temporalType
+ * @return the same query instance } correspond to positional parameter of query
+ */
+ public Query setParameter(int position, Calendar value, TemporalType temporalType);
+
+ /**
+ * Set the flush mode type to be used for the query execution.
+ * The flush mode type applies to the query regardless of the
+ * flush mode type in use for the entity manager.
+ *
+ * @param flushMode
+ */
+ public Query setFlushMode(FlushModeType flushMode);
+
+}
\ No newline at end of file
/src/javax/persistence/Query.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PrimaryKeyJoinColumns.java
===================================================================
--- src/javax/persistence/PrimaryKeyJoinColumns.java (revision 0)
+++ src/javax/persistence/PrimaryKeyJoinColumns.java (revision 33)
@@ -0,0 +1,22 @@
+//$Id: PrimaryKeyJoinColumns.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * This annotation groups PrimaryKeyJoinColumn annotations. It is used to map composite foreign keys.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+public @interface PrimaryKeyJoinColumns {
+ /**
+ * One or more PrimaryKeyJoinColumn annotations
+ */
+ PrimaryKeyJoinColumn[] value();
+}
/src/javax/persistence/PrimaryKeyJoinColumns.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/FieldResult.java
===================================================================
--- src/javax/persistence/FieldResult.java (revision 0)
+++ src/javax/persistence/FieldResult.java (revision 33)
@@ -0,0 +1,25 @@
+//$Id: FieldResult.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Is used to map the columns specified in the SELECT list of the query to the properties
+ * or fields of the entity class.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({}) @Retention(RetentionPolicy.RUNTIME)
+public @interface FieldResult {
+ /**
+ * Name of the persistent field or property of the class.
+ */
+ String name();
+ /**
+ * Name of the column in the SELECT clause - i.e., column aliases, if applicable.
+ */
+ String column();
+}
/src/javax/persistence/FieldResult.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/CascadeType.java
===================================================================
--- src/javax/persistence/CascadeType.java (revision 0)
+++ src/javax/persistence/CascadeType.java (revision 33)
@@ -0,0 +1,32 @@
+//$Id: CascadeType.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+/**
+ * Defines the set of cascadable operations that are propagated to the associated entity.
+ * The value cascade=ALL is equivalent to cascade={PERSIST, MERGE, REMOVE, REFRESH}.
+ *
+ * @author Emmanuel Bernard
+ */
+public enum CascadeType {
+ /**
+ * Cascade all operations
+ */
+ ALL,
+ /**
+ * Cascade persist operations
+ */
+ PERSIST,
+ /**
+ * Cascade merge operations
+ */
+ MERGE,
+ /**
+ * Cascade remove operations
+ */
+ REMOVE,
+ /**
+ * Cascade refresh operations
+ */
+ REFRESH
+}
/src/javax/persistence/CascadeType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Version.java
===================================================================
--- src/javax/persistence/Version.java (revision 0)
+++ src/javax/persistence/Version.java (revision 33)
@@ -0,0 +1,28 @@
+//$Id: Version.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+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)
+public @interface Version {}
/src/javax/persistence/Version.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/SqlResultSetMapping.java
===================================================================
--- src/javax/persistence/SqlResultSetMapping.java (revision 0)
+++ src/javax/persistence/SqlResultSetMapping.java (revision 33)
@@ -0,0 +1,29 @@
+//$Id: SqlResultSetMapping.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This annotation is used to specify the mapping of the result of a native SQL query
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME)
+public @interface SqlResultSetMapping {
+ /**
+ * The name given to the result set mapping, and used to refer to it in the methods of the Query API
+ */
+ String name();
+ /**
+ * Specifies the result set mapping to entities
+ */
+ EntityResult[] entities() default {};
+ /**
+ * Specifies the result set mapping to scalar values
+ */
+ ColumnResult[] columns() default {};
+}
/src/javax/persistence/SqlResultSetMapping.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/ExcludeSuperclassListeners.java
===================================================================
--- src/javax/persistence/ExcludeSuperclassListeners.java (revision 0)
+++ src/javax/persistence/ExcludeSuperclassListeners.java (revision 33)
@@ -0,0 +1,17 @@
+//$Id: ExcludeSuperclassListeners.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+
+/**
+ * Specifies that the invocation of superclass listeners is to be excluded for the
+ * entity class (or mapped superclass) and its subclasses.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target(TYPE) @Retention(RUNTIME)
+public @interface ExcludeSuperclassListeners {
+}
/src/javax/persistence/ExcludeSuperclassListeners.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Table.java
===================================================================
--- src/javax/persistence/Table.java (revision 0)
+++ src/javax/persistence/Table.java (revision 33)
@@ -0,0 +1,48 @@
+//$Id: Table.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+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 {};
+}
/src/javax/persistence/Table.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/ExcludeDefaultListeners.java
===================================================================
--- src/javax/persistence/ExcludeDefaultListeners.java (revision 0)
+++ src/javax/persistence/ExcludeDefaultListeners.java (revision 33)
@@ -0,0 +1,17 @@
+//$Id: ExcludeDefaultListeners.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies that the invocation of default listeners is to be excluded for the entity class
+ * (or mapped superclass) and its subclasses.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target(TYPE) @Retention(RUNTIME)
+public @interface ExcludeDefaultListeners {
+}
/src/javax/persistence/ExcludeDefaultListeners.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/FlushModeType.java
===================================================================
--- src/javax/persistence/FlushModeType.java (revision 0)
+++ src/javax/persistence/FlushModeType.java (revision 33)
@@ -0,0 +1,29 @@
+//$Id: FlushModeType.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Flush mode setting.
+ *
+ * When queries are executed within a transaction, if FlushModeType.AUTO is set on the Query object,
+ * or if the flush mode setting for the persistence context is AUTO (the default) and a flush mode
+ * setting has not been specified for the Query object, the persistence provider is responsible for
+ * ensuring that all updates to the state of all entities in the persistence context which could
+ * potentially affect the result of the query are visible to the processing of the query.
+ * The persistence provider implementation may achieve this by flushing those entities to the database
+ * or by some other means. If FlushModeType.COMMIT is set, the effect of updates made to entities in the
+ * persistence context upon queries is unspecified.
+ *
+ * If there is no transaction active, the persistence provider must not flush to the database.
+ *
+ * @author Gavin King
+ */
+public enum FlushModeType {
+ /**
+ * Flushing must occur only at transaction commit
+ */
+ COMMIT,
+ /**
+ * (Default) Flushing to occur at query execution
+ */
+ AUTO
+}
/src/javax/persistence/FlushModeType.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PersistenceProperty.java
===================================================================
--- src/javax/persistence/PersistenceProperty.java (revision 0)
+++ src/javax/persistence/PersistenceProperty.java (revision 33)
@@ -0,0 +1,27 @@
+//$Id: $
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Describes a single container or persistence provider property.
+ * Vendor specific properties may be included in the set of properties, and are passed to the persistence
+ * provider by the container when the entity manager is created.
+ * Properties that are not recognized by a vendor will be ignored.
+ *
+ * @author Emmanuel Bernard
+ */
+@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
/src/javax/persistence/PersistenceProperty.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/GeneratedValue.java
===================================================================
--- src/javax/persistence/GeneratedValue.java (revision 0)
+++ src/javax/persistence/GeneratedValue.java (revision 33)
@@ -0,0 +1,32 @@
+//$Id: GeneratedValue.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Provides for the specification of generation strategies for the values of primary keys.
+ * The GeneratedValue annotation may be applied to a primary key property or field of an entity
+ * or mapped superclass in conjunction with the Id annotation.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface GeneratedValue {
+ /**
+ * The primary key generation strategy that the persistence provider must use
+ * to generate the annotated entity primary key.
+ */
+ GenerationType strategy() default GenerationType.AUTO;
+ /**
+ * The name of the primary key generator to use as specified in the SequenceGenerator or
+ * TableGenerator annotation.
+ *
+ * Defaults to the id generator supplied by persistence provider.
+ */
+ String generator() default "";
+}
/src/javax/persistence/GeneratedValue.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/InheritanceType.java
===================================================================
--- src/javax/persistence/InheritanceType.java (revision 0)
+++ src/javax/persistence/InheritanceType.java (revision 33)
@@ -0,0 +1,25 @@
+//$Id: InheritanceType.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+/**
+ * Defines inheritance strategy options.
+ *
+ * @author Emmanuel Bernard
+ */
+public enum InheritanceType
+{
+ /**
+ * A single table per class hierarchy
+ */
+ SINGLE_TABLE,
+ /**
+ * A table per concrete entity class
+ */
+ TABLE_PER_CLASS,
+ /**
+ * A strategy in which fields that are specific to a subclass are mapped to a separate
+ * table than the fields that are common to the parent class, and a join is performed
+ * to instantiate the subclass.
+ */
+ JOINED };
/src/javax/persistence/InheritanceType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Id.java
===================================================================
--- src/javax/persistence/Id.java (revision 0)
+++ src/javax/persistence/Id.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: Id.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+
+/**
+ * Specifies the primary key property or field of an entity.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface Id {}
/src/javax/persistence/Id.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/GenerationType.java
===================================================================
--- src/javax/persistence/GenerationType.java (revision 0)
+++ src/javax/persistence/GenerationType.java (revision 33)
@@ -0,0 +1,34 @@
+//$Id: GenerationType.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+/**
+ * Defines the types of primary key generation.
+ *
+ * @author Emmanuel Bernard
+ */
+public enum GenerationType {
+ /**
+ * Indicates that the persistence provider must assign primary keys for the entity using an underlying
+ * database table to ensure uniqueness.
+ */
+ TABLE,
+ /**
+ * Indicates that the persistence provider must assign primary keys for the entity using database
+ * sequence column.
+ */
+ SEQUENCE,
+ /**
+ * Indicates that the persistence provider must assign primary keys for the entity using
+ * database identity column.
+ */
+ IDENTITY,
+ /**
+ * Indicates that the persistence provider should pick an appropriate strategy for the
+ * particular database. The AUTO generation strategy may expect a database resource
+ * to exist, or it may attempt to create one. A vendor may provide documentation on how
+ * to create such resources in the event that it does not support schema generation or cannot
+ * create the schema resource at runtime.
+ */
+ AUTO
+};
/src/javax/persistence/GenerationType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Column.java
===================================================================
--- src/javax/persistence/Column.java (revision 0)
+++ src/javax/persistence/Column.java (revision 33)
@@ -0,0 +1,65 @@
+//$Id: Column.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Is used to specify a mapped column for a persistent property or field. If no Column annotation is
+ * specified, the default values are applied.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface Column {
+ /**
+ * The name of the column. Defaults to the property or field name
+ */
+ String name() default "";
+ /**
+ * Whether the property is a unique key. This is a shortcut for the UniqueConstraint
+ * annotation at the table level and is useful for when the unique key constraint is
+ * only a single field. This constraint applies in addition to any constraint entailed
+ * by primary key mapping and to constraints specified at the table level.
+ */
+ boolean unique() default false;
+ /**
+ * Whether the database column is nullable
+ */
+ boolean nullable() default true;
+ /**
+ * Whether the column is included in SQL INSERT statements generated by the persistence provider.
+ */
+ boolean insertable() default true;
+ /**
+ * Whether the column is included in SQL UPDATE statements generated by the persistence provider.
+ */
+ boolean updatable() default true;
+ /**
+ * The SQL fragment that is used when generating the DDL for the column.
+ * Defaults to the generated SQL to create a column of the inferred type.
+ */
+ String columnDefinition() default "";
+ /**
+ * The name of the table that contains the column. If absent the column is assumed to
+ * be in the primary table.
+ */
+ String table() default "";
+ /**
+ * The column length. (Applies only if a string-valued column is used.)
+ */
+ int length() default 255;
+ /**
+ * The precision for a decimal (exact numeric) column. (Applies only if a decimal column is used.)
+ * Value must be set by developer if used when generating the DDL for the column.
+ */
+ int precision() default 0;
+ /**
+ * The scale for a decimal (exact numeric) column. (Applies only if a decimal column is used.)
+ */
+ int scale() default 0;
+}
/src/javax/persistence/Column.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/LockModeType.java
===================================================================
--- src/javax/persistence/LockModeType.java (revision 0)
+++ src/javax/persistence/LockModeType.java (revision 33)
@@ -0,0 +1,40 @@
+//$Id: LockModeType.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Lock modes that can be specified by means of the EntityManager.lock() method.
+ *
+ * The semantics of requesting locks of type LockModeType.READ and LockModeType.WRITE are t
+ * he following.
+ *
+ * If transaction T1 calls lock(entity, LockModeType.READ) on a versioned object, the entity
+ * manager must ensure that neither of the following phenomena can occur:
+ *
+ * * P1 (Dirty read): Transaction T1 modifies a row. Another transaction T2 then reads
+ * that row and obtains the modified value, before T1 has committed or rolled back.
+ * Transaction T2 eventually commits successfully; it does not matter whether T1 commits or rolls
+ * back and whether it does so before or after T2 commits.
+ *
+ * * P2 (Non-repeatable read): Transaction T1 reads a row. Another transaction T2 then modifies
+ * or deletes that row, before T1 has committed. Both transactions eventually commit successfully.
+ *
+ * Lock modes must always prevent the phenomena P1 and P2.
+ * In addition, calling lock(entity, LockModeType.WRITE) on a versioned object,
+ * will also force an update (increment) to the entity's version column.
+ *
+ * The persistence implementation is not required to support calling EntityManager.lock()
+ * on a non-versioned object. When it cannot support a such lock call, it must
+ * throw the PersistenceException.
+ *
+ * @author Emmanuel Bernard
+ */
+public enum LockModeType {
+ /**
+ * Read lock
+ */
+ READ,
+ /**
+ * Write lock
+ */
+ WRITE
+}
/src/javax/persistence/LockModeType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/SecondaryTable.java
===================================================================
--- src/javax/persistence/SecondaryTable.java (revision 0)
+++ src/javax/persistence/SecondaryTable.java (revision 33)
@@ -0,0 +1,53 @@
+//$Id: SecondaryTable.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+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 {};
+}
/src/javax/persistence/SecondaryTable.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PrePersist.java
===================================================================
--- src/javax/persistence/PrePersist.java (revision 0)
+++ src/javax/persistence/PrePersist.java (revision 33)
@@ -0,0 +1,25 @@
+/* $Id: PrePersist.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 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 {
+}
/src/javax/persistence/PrePersist.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PreRemove.java
===================================================================
--- src/javax/persistence/PreRemove.java (revision 0)
+++ src/javax/persistence/PreRemove.java (revision 33)
@@ -0,0 +1,25 @@
+/* $Id: PreRemove.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * 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 {
+}
/src/javax/persistence/PreRemove.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Embeddable.java
===================================================================
--- src/javax/persistence/Embeddable.java (revision 0)
+++ src/javax/persistence/Embeddable.java (revision 33)
@@ -0,0 +1,22 @@
+//$Id: Embeddable.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB Specification Copyright 2004 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+
+/**
+ * Defines a class whose instances are stored as an intrinsic part of an owning entity and share
+ * the identity of the entity. Each of the persistent properties or fields of the embedded object
+ * is mapped to the database table for the entity. Only Basic, Column, Lob, Temporal, and
+ * Enumerated mapping annotations may portably be used to map the persistent fields or properties
+ * of classes annotated as Embeddable.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface Embeddable {}
/src/javax/persistence/Embeddable.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/DiscriminatorValue.java
===================================================================
--- src/javax/persistence/DiscriminatorValue.java (revision 0)
+++ src/javax/persistence/DiscriminatorValue.java (revision 33)
@@ -0,0 +1,33 @@
+//$Id: DiscriminatorValue.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+
+/**
+ * Is used to specify the value of the discriminator column for entities of the given type.
+ * The DiscriminatorValue annotation can only be specified on a concrete entity class.
+ * If the DiscriminatorValue annotation is not specified and a discriminator column is used,
+ * a provider-specific function will be used to generate a value representing the entity type.
+ * If the DiscriminatorType is STRING, the discriminator value default is the entity name.
+ *
+ * The inheritance strategy and the discriminator column are only specified in the root
+ * of an entity class hierarchy or subhierarchy in which a different inheritance strategy
+ * is applied. The discriminator value, if not defaulted, should be specified for each entity
+ * class in the hierarchy.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface DiscriminatorValue {
+ /**
+ * The value that indicates that the row is an entity of the annotated entity type.
+ *
+ * If the DiscriminatorValue annotation is not specified and a discriminator column is used,
+ * a provider-specific function will be used to generate a value representing the entity type.
+ * If the DiscriminatorType is STRING, the discriminator value default is the entity name.
+ */
+ String value();
+}
/src/javax/persistence/DiscriminatorValue.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/TransactionRequiredException.java
===================================================================
--- src/javax/persistence/TransactionRequiredException.java (revision 0)
+++ src/javax/persistence/TransactionRequiredException.java (revision 33)
@@ -0,0 +1,26 @@
+//$Id: TransactionRequiredException.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Thrown by the persistence provider when a transaction is required but is not active.
+ * @author Gavin King
+ */
+public class TransactionRequiredException extends PersistenceException {
+
+ /**
+ * Constructs a new TransactionRequiredException exception with null as its detail message
+ */
+ public TransactionRequiredException() {
+ super();
+ }
+
+ /**
+ * Constructs a new TransactionRequiredException exception with the specified detail message
+ *
+ * @param message
+ */
+ public TransactionRequiredException(String message) {
+ super( message );
+ }
+
+}
/src/javax/persistence/TransactionRequiredException.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Transient.java
===================================================================
--- src/javax/persistence/Transient.java (revision 0)
+++ src/javax/persistence/Transient.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: Transient.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+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)
+public @interface Transient {}
/src/javax/persistence/Transient.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/SqlResultSetMappings.java
===================================================================
--- src/javax/persistence/SqlResultSetMappings.java (revision 0)
+++ src/javax/persistence/SqlResultSetMappings.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: SqlResultSetMapping.java 9044 2006-01-12 20:58:41 -0500 (jeu., 12 janv. 2006) epbernard $
+//EJB3 Specification Copyright 2004 - 2006 Sun Microsystems, Inc.
+
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * This annotation is used to define one or more SqlResultSetMapping
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME)
+public @interface SqlResultSetMappings {
+ SqlResultSetMapping[] value();
+}
/src/javax/persistence/SqlResultSetMappings.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/ManyToOne.java
===================================================================
--- src/javax/persistence/ManyToOne.java (revision 0)
+++ src/javax/persistence/ManyToOne.java (revision 33)
@@ -0,0 +1,44 @@
+//$Id: ManyToOne.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static javax.persistence.FetchType.*;
+
+/**
+ * This annotation defines a single-valued association to another entity class that has
+ * many-to-one multiplicity. It is not normally necessary to specify the target entity
+ * explicitly since it can usually be inferred from the type of the object being referenced.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface ManyToOne {
+ /**
+ * The entity class that is the target of the association.
+ *
+ * Defaults to the type of the field or property that stores the association
+ */
+ Class targetEntity() default void.class;
+ /**
+ * The operations that must be cascaded to the target of the association.
+ *
+ * By default no operations are cascaded.
+ */
+ CascadeType[] cascade() default {};
+ /**
+ * Whether the association should be lazily loaded or must be eagerly fetched.
+ * The EAGER strategy is a requirement on the persistence provider runtime that
+ * the associated entity must be eagerly fetched. The LAZY strategy is a hint to
+ * the persistence provider runtime.
+ */
+ FetchType fetch() default EAGER;
+ /**
+ * Whether the association is optional. If set to false then a non-null relationship must always exist.
+ */
+ boolean optional() default true;
+}
/src/javax/persistence/ManyToOne.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EntityResult.java
===================================================================
--- src/javax/persistence/EntityResult.java (revision 0)
+++ src/javax/persistence/EntityResult.java (revision 33)
@@ -0,0 +1,33 @@
+//$Id: EntityResult.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * References an entity in the SELECT clause of a SQL query. If this annotation is used,
+ * the SQL statement should select all of the columns that are mapped to the entity object.
+ * This should include foreign key columns to related entities. The results obtained when
+ * insufficient data is available are undefined.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({}) @Retention(RetentionPolicy.RUNTIME)
+public @interface EntityResult {
+ /**
+ * The class of the result
+ */
+ Class entityClass();
+ /**
+ * Maps the columns specified in the SELECT list of the query to the properties or
+ * fields of the entity class.
+ */
+ FieldResult[] fields() default {};
+ /**
+ * Specifies the column name (or alias) of the column in the SELECT list that is used to
+ * determine the type of the entity instance.
+ */
+ String discriminatorColumn() default "";
+}
/src/javax/persistence/EntityResult.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Entity.java
===================================================================
--- src/javax/persistence/Entity.java (revision 0)
+++ src/javax/persistence/Entity.java (revision 33)
@@ -0,0 +1,23 @@
+//$Id: Entity.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies that the class is an entity. This annotation is applied to the entity class.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target(TYPE) @Retention(RUNTIME)
+public @interface Entity {
+ /**
+ * The name of an entity. Defaults to the unqualified name of the entity class.
+ * This name is used to refer to the entity in queries. The name must not be a
+ * reserved literal in the Java Persistence query language.
+ */
+ String name() default "";
+}
/src/javax/persistence/Entity.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PersistenceContexts.java
===================================================================
--- src/javax/persistence/PersistenceContexts.java (revision 0)
+++ src/javax/persistence/PersistenceContexts.java (revision 33)
@@ -0,0 +1,27 @@
+/* $Id: PersistenceContexts.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Declares one or more PersistenceContext annotations. It is used to express a dependency on
+ * container-managed entity manager persistence contexts.
+ *
+ * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PersistenceContexts {
+ /**
+ * One or more persistence context
+ */
+ PersistenceContext[] value();
+}
/src/javax/persistence/PersistenceContexts.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Lob.java
===================================================================
--- src/javax/persistence/Lob.java (revision 0)
+++ src/javax/persistence/Lob.java (revision 33)
@@ -0,0 +1,25 @@
+//$Id: Lob.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.METHOD;
+
+import static java.lang.annotation.ElementType.FIELD;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+
+/**
+ * Specifies that a persistent property or field should be persisted as a large object to a
+ * database-supported large object type. The Lob annotation may be used in conjunction with
+ * the Basic annotation. A Lob may be either a binary or character type.
+ *
+ * The Lob type is inferred from the type of the persistent field or property, and except
+ * for string and character-based types defaults to Blob.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface Lob {}
\ No newline at end of file
/src/javax/persistence/Lob.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Basic.java
===================================================================
--- src/javax/persistence/Basic.java (revision 0)
+++ src/javax/persistence/Basic.java (revision 33)
@@ -0,0 +1,39 @@
+//$Id: Basic.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+import static javax.persistence.FetchType.EAGER;
+
+/**
+ * The Basic annotation is the simplest type of mapping to a database column. The Basic
+ * annotation can be applied to a persistent property or instance variable of any of the
+ * following types: Java primitive types, wrappers of the primitive types, String,
+ * java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar,
+ * java.sql.Date, java.sql.Time, java.sql.Timestamp, byte[], Byte[], char[], Character[],
+ * enums, and any other type that implements Serializable.
+ *
+ * The use of the Basic annotation is optional for persistent fields and properties of these types.
+
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface Basic {
+ /**
+ * Defines whether the value of the field or property should be lazily loaded or must be
+ * eagerly fetched. The EAGER strategy is a requirement on the persistence provider runtime
+ * that the value must be eagerly fetched. The LAZY strategy is a hint to the persistence
+ * provider runtime. If not specified, defaults to EAGER.
+ */
+ FetchType fetch() default EAGER;
+ /**
+ * Defines whether the value of the field or property may be null. This is a hint and is
+ * disregarded for primitive types; it may be used in schema generation. If not specified,
+ * defaults to true.
+ */
+ boolean optional() default true;
+}
/src/javax/persistence/Basic.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/NamedNativeQuery.java
===================================================================
--- src/javax/persistence/NamedNativeQuery.java (revision 0)
+++ src/javax/persistence/NamedNativeQuery.java (revision 33)
@@ -0,0 +1,39 @@
+//$Id: NamedNativeQuery.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Is used to specify a native SQL named query. Query names are scoped to the persistence unit.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface NamedNativeQuery {
+ /**
+ * Is used to refer to the query when using the EntityManager methods that create query objects
+ */
+ String name();
+ /**
+ * The SQL query string
+ */
+ String query();
+
+ /**
+ * Vendor-specific query hints
+ */
+ QueryHint[] hints() default {};
+ /**
+ * The class of the result
+ */
+ Class resultClass() default void.class;
+ /**
+ * The name of a SqlResultSetMapping, as defined in metadata
+ */
+ String resultSetMapping() default ""; // name of SQLResultSetMapping
+}
/src/javax/persistence/NamedNativeQuery.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/NamedQueries.java
===================================================================
--- src/javax/persistence/NamedQueries.java (revision 0)
+++ src/javax/persistence/NamedQueries.java (revision 33)
@@ -0,0 +1,21 @@
+//$Id: NamedQueries.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies an array of named Java Persistence query language queries. Query names are scoped to the persistence unit.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface NamedQueries {
+ /**
+ * An array of named Java Persistence query language queries.
+ */
+ NamedQuery [] value ();
+}
/src/javax/persistence/NamedQueries.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/package-info.java
===================================================================
--- src/javax/persistence/package-info.java (revision 0)
+++ src/javax/persistence/package-info.java (revision 33)
@@ -0,0 +1,9 @@
+//$Id:$
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+
+/**
+ * The javax.persistence package contains the classes and interfaces that define the contracts
+ * between a persistence provider and the managed classes and the clients of the Java Persistence API.
+ */
+package javax.persistence;
+
/src/javax/persistence/package-info.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/OneToOne.java
===================================================================
--- src/javax/persistence/OneToOne.java (revision 0)
+++ src/javax/persistence/OneToOne.java (revision 33)
@@ -0,0 +1,51 @@
+//$Id: OneToOne.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static javax.persistence.FetchType.*;
+
+/**
+ * This annotation defines a single-valued association to another entity that has
+ * one-to-one multiplicity. It is not normally necessary to specify the associated
+ * target entity explicitly since it can usually be inferred from the type of the object
+ * being referenced.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface OneToOne {
+ /**
+ * The entity class that is the target of the association.
+ *
+ * Defaults to the type of the field or property that stores the association.
+ */
+ Class targetEntity() default void.class;
+ /**
+ * The operations that must be cascaded to the target of the association.
+ *
+ * By default no operations are cascaded.
+ */
+ CascadeType[] cascade() default {};
+ /**
+ * Whether the association should be lazily loaded or must be eagerly fetched.
+ * The EAGER strategy is a requirement on the persistence provider runtime that
+ * the associated entity must be eagerly fetched. The LAZY strategy is a hint to
+ * the persistence provider runtime.
+ */
+ FetchType fetch() default EAGER;
+ /**
+ * Whether the association is optional. If set to false then a non-null relationship must
+ * always exist.
+ */
+ boolean optional() default true;
+ /**
+ * The field that owns the relationship. This element is only specified on the
+ * inverse (non-owning) side of the association.
+ */
+ String mappedBy() default "";
+}
/src/javax/persistence/OneToOne.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PersistenceContext.java
===================================================================
--- src/javax/persistence/PersistenceContext.java (revision 0)
+++ src/javax/persistence/PersistenceContext.java (revision 33)
@@ -0,0 +1,43 @@
+/* $Id: PersistenceContext.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Expresses a dependency on an EntityManager persistence context.
+ *
+ * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
+ */
+@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PersistenceContext {
+ /**
+ * The name by which the entity manager 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. If the unitName element is specified, the persistence unit
+ * for the entity manager that is accessible in JNDI must have the same name.
+ */
+ String unitName() default "";
+ /**
+ * Used to specify properties for the container or persistence provider. Vendor specific
+ * properties may be included in this set of properties. Properties that are not
+ * recognized by a vendor are ignored.
+ */
+ PersistenceProperty[] properties() default {};
+ /**
+ * Specifies whether this is a transaction-scoped persistence context or
+ * an extended persistence context.
+ */
+ PersistenceContextType type() default PersistenceContextType.TRANSACTION;
+}
/src/javax/persistence/PersistenceContext.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/Embedded.java
===================================================================
--- src/javax/persistence/Embedded.java (revision 0)
+++ src/javax/persistence/Embedded.java (revision 33)
@@ -0,0 +1,18 @@
+//$Id: Embedded.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB Specification Copyright 2004 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Defines a persistent field or property of an entity whose value is an instance of
+ * an embeddable class. The embeddable class must be annotated as Embeddable.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface Embedded {}
/src/javax/persistence/Embedded.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/NoResultException.java
===================================================================
--- src/javax/persistence/NoResultException.java (revision 0)
+++ src/javax/persistence/NoResultException.java (revision 33)
@@ -0,0 +1,27 @@
+//$Id: NoResultException.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Thrown by the persistence provider when getSingleResult() is executed on a query and there is no result to return.
+ * This exception will not cause the current transaction, if one is active, to be marked for roll back.
+ *
+ * @author Emmanuel Bernard
+ */
+public class NoResultException extends PersistenceException {
+
+ /**
+ * Constructs a new NoResultException exception with null as its detail message
+ */
+ public NoResultException() {
+ super();
+ }
+
+ /**
+ * Constructs a new NoResultException exception with the specified detail message.
+ *
+ * @param message
+ */
+ public NoResultException(String message) {
+ super( message );
+ }
+}
/src/javax/persistence/NoResultException.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/ManyToMany.java
===================================================================
--- src/javax/persistence/ManyToMany.java (revision 0)
+++ src/javax/persistence/ManyToMany.java (revision 33)
@@ -0,0 +1,51 @@
+//$Id: ManyToMany.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static javax.persistence.FetchType.*;
+
+/**
+ * Defines a many-valued association with many-to-many multiplicity. If the Collection is
+ * defined using generics to specify the element type, the associated target entity class
+ * does not need to be specified; otherwise it must be specified.
+ *
+ * Every many-to-many association has two sides, the owning side and the non-owning, or inverse,
+ * side. The join table is specified on the owning side. If the association is bidirectional,
+ * either side may be designated as the owning side.
+ *
+ * The same annotation elements for the OneToMany annotation apply to the ManyToMany annotation.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface ManyToMany {
+ /**
+ * The entity class that is the target of the association. Optional only if the
+ * collection property is defined using Java generics. Must be specified otherwise.
+ *
+ * Defaults to the parameterized type of the collection when defined using generics.
+ */
+ Class targetEntity() default void.class;
+ /**
+ * The operations that must be cascaded to the target of the association.
+ *
+ * Defaults to no operations being cascaded.
+ */
+ CascadeType[] cascade() default {};
+ /**
+ * Whether the association should be lazily loaded or must be eagerly fetched.
+ * The EAGER strategy is a requirement on the persistenceprovider runtime that
+ * the associatedentities must be eagerly fetched. The LAZY strategy is a hint
+ * to the persistence provider runtime.
+ */
+ FetchType fetch() default LAZY;
+ /**
+ * The field that owns the relationship. Required unless the relationship is unidirectional.
+ */
+ String mappedBy() default "";
+}
\ No newline at end of file
/src/javax/persistence/ManyToMany.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/TableGenerator.java
===================================================================
--- src/javax/persistence/TableGenerator.java (revision 0)
+++ src/javax/persistence/TableGenerator.java (revision 33)
@@ -0,0 +1,67 @@
+//$Id: TableGenerator.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import static java.lang.annotation.ElementType.*;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation defines a primary key generator that may be referenced by name when a generator
+ * element is specified for the GeneratedValue annotation. A table generator may be specified on the
+ * entity class or on the primary key field or property. The scope of the generator name is global to
+ * the persistence unit (across all generator types).
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface TableGenerator {
+ /**
+ * A unique generator name that can be referenced by one or more classes to be the generator for id values
+ */
+ String name();
+ /**
+ * Name of table that stores the generated id values. Defaults to a name chosen by persistence provider.
+ */
+ String table() 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 "";
+ /**
+ * Name of the primary key column in the table
+ * Defaults to a provider-chosen name
+ */
+ String pkColumnName() default "";
+ /**
+ * Name of the column that stores the last value generated
+ * Defaults to a provider-chosen name
+ */
+ String valueColumnName() default "";
+ /**
+ * The primary key value in the generator table that distinguishes this set of generated values from others that may be stored in the table
+ * Defaults to a provider-chosen value to store in the primary key column of the generator table
+ */
+ String pkColumnValue() default "";
+ /**
+ * The initial value to be used when allocating id numbers from the generator
+ */
+ int initialValue() default 0;
+ /**
+ * The amount to increment by when allocating id numbers from the generator
+ */
+ int allocationSize() default 50;
+ /**
+ * 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 primary key constraints
+ * Defaults to no additional constraints
+ */
+ UniqueConstraint[] uniqueConstraints() default {};
+}
/src/javax/persistence/TableGenerator.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/AssociationOverrides.java
===================================================================
--- src/javax/persistence/AssociationOverrides.java (revision 0)
+++ src/javax/persistence/AssociationOverrides.java (revision 33)
@@ -0,0 +1,24 @@
+//$Id:$
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+
+/**
+ * This annotation is used to override mappings of multiple many-to-one
+ * or one-to-one relationship properties or fields.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+public @interface AssociationOverrides {
+ /**
+ * Mapping overrides of relationship properties or fields
+ */
+ AssociationOverride[] value();
+}
/src/javax/persistence/AssociationOverrides.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/JoinColumns.java
===================================================================
--- src/javax/persistence/JoinColumns.java (revision 0)
+++ src/javax/persistence/JoinColumns.java (revision 33)
@@ -0,0 +1,23 @@
+//$Id: JoinColumns.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Defines mapping for the composite foreign keys.
+ * This annotation groups JoinColumn annotations for the same relationship.
+ *
+ * When the JoinColumns annotation is used, both the name and the referencedColumnName
+ * elements must be specified in each such JoinColumn annotation.
+
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface JoinColumns {
+ JoinColumn[] value();
+}
/src/javax/persistence/JoinColumns.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/AttributeOverride.java
===================================================================
--- src/javax/persistence/AttributeOverride.java (revision 0)
+++ src/javax/persistence/AttributeOverride.java (revision 33)
@@ -0,0 +1,34 @@
+//$Id: AttributeOverride.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+
+/**
+ * The AttributeOverride annotation is used to override the mapping of a Basic (whether explicit
+ * or default) property or field or Id property or field.
+ *
+ * The AttributeOverride annotation may be applied to an entity that extends a mapped superclass
+ * or to an embedded field or property to override a basic mapping defined by the mapped superclass
+ * or embeddable class. If the AttributeOverride annotation is not specified, the column is mapped
+ * the same as in the original mapping.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+public @interface AttributeOverride {
+ /**
+ * The name of the property whose mapping is being overridden if property-based access is being
+ * used, or the name of the field if field-based access is used.
+ */
+ String name();
+ /**
+ * The column that is being mapped to the persistent attribute
+ */
+ Column column();
+}
/src/javax/persistence/AttributeOverride.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/OrderBy.java
===================================================================
--- src/javax/persistence/OrderBy.java (revision 0)
+++ src/javax/persistence/OrderBy.java (revision 33)
@@ -0,0 +1,39 @@
+//$Id: OrderBy.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * This annotation specifies the ordering of the elements of a collection valued association at the
+ * point when the association is retrieved.
+ *
+ * The syntax of the value ordering element is an orderby_list, as follows:
+ * <code>orderby_list::= orderby_item [,orderby_item]*
+ * orderby_item::= property_or_field_name [ASC | DESC]</code>
+ *
+ * If ASC or DESC is not specified, ASC (ascending order) is assumed.
+ *
+ * If the ordering element is not specified, ordering by the primary key of the associated
+ * entity is assumed.
+ *
+ * The property or field name must correspond to that of a persistent property or field of the
+ * associated class. The properties or fields used in the ordering must correspond to columns
+ * for which comparison operators are supported.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface OrderBy {
+ /**
+ * An orderby_list, specified as follows:
+ * orderby_list::= orderby_item [,orderby_item]* orderby_item::= property_or_field_name [ASC | DESC]
+ *
+ * If ASC or DESC is not specified, ASC (ascending order) is assumed.
+ *
+ */
+ String value() default "";
+}
/src/javax/persistence/OrderBy.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EnumType.java
===================================================================
--- src/javax/persistence/EnumType.java (revision 0)
+++ src/javax/persistence/EnumType.java (revision 33)
@@ -0,0 +1,19 @@
+//$Id: EnumType.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Defines mapping for the enumerated types. The constants of this enumerated type specify how persistent
+ * property or field should be persisted as a enumerated type.
+ *
+ * @author Emmanuel Bernard
+ */
+public enum EnumType {
+ /**
+ * Persist enumerated type property or field as an integer
+ */
+ ORDINAL,
+ /**
+ * Persist enumerated type property or field as a string
+ */
+ STRING
+}
/src/javax/persistence/EnumType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/JoinTable.java
===================================================================
--- src/javax/persistence/JoinTable.java (revision 0)
+++ src/javax/persistence/JoinTable.java (revision 33)
@@ -0,0 +1,63 @@
+//$Id: JoinTable.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * This annotation is used in the mapping of associations. It is specified on the owning
+ * side of a many-to-many association, or in a unidirectional one-to-many association.
+ *
+ * If the JoinTable annotation is missing, the default values of the annotation elements apply.
+ * The name of the join table is assumed to be the table names of the associated primary tables
+ * concatenated together (owning side first) using an underscore.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface JoinTable {
+ /**
+ * The name of the join table.
+ *
+ * Defaults to the concatenated names of the two associated primary entity tables,
+ * separated by an underscore
+ */
+ 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 "";
+ /**
+ * The foreign key columns of the join table which reference the primary table of the
+ * entity owning the association (i.e. the owning side of the association).
+ *
+ * Uses the same defaults as for JoinColumn.
+ */
+ JoinColumn[] joinColumns() default {};
+ /**
+ * The foreign key columns of the join table which reference the primary table of the entity
+ * that does not own the association (i.e. the inverse side of the association).
+ *
+ * Uses the same defaults as for JoinColumn
+ */
+ JoinColumn[] inverseJoinColumns() default {};
+ /**
+ * Unique constraints that are to be placed on the table. These are only used if table
+ * generation is in effect.
+ *
+ * Defaults to no additional constraints
+ */
+ UniqueConstraint[] uniqueConstraints() default {};
+}
/src/javax/persistence/JoinTable.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/PersistenceUnits.java
===================================================================
--- src/javax/persistence/PersistenceUnits.java (revision 0)
+++ src/javax/persistence/PersistenceUnits.java (revision 33)
@@ -0,0 +1,26 @@
+/* $Id: PersistenceUnits.java 11282 2007-03-14 22:05:59Z epbernard $
+ * JBoss Inc
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package javax.persistence;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Declares one or more PersistenceUnit annotations
+ *
+ * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
+ */
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PersistenceUnits {
+ /**
+ * One or more PersistenceUnit annotations
+ */
+ PersistenceUnit[] value();
+}
/src/javax/persistence/PersistenceUnits.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/EntityNotFoundException.java
===================================================================
--- src/javax/persistence/EntityNotFoundException.java (revision 0)
+++ src/javax/persistence/EntityNotFoundException.java (revision 33)
@@ -0,0 +1,29 @@
+//$Id: EntityNotFoundException.java 11282 2007-03-14 22:05:59Z epbernard $
+package javax.persistence;
+
+/**
+ * Thrown by the persistence provider when an entity reference obtained by
+ * EntityManager.getReference(Class,Object) is accessed but the entity does not exist.
+ * Also thrown when EntityManager.refresh(Object) is called and the object no longer exists
+ * in the database. The current transaction, if one is active, will be marked for rollback.
+ *
+ * @author Gavin King
+ */
+public class EntityNotFoundException extends PersistenceException {
+ /**
+ * Constructs a new EntityNotFoundException exception with null as its detail message.
+ */
+ public EntityNotFoundException() {
+ super();
+ }
+
+ /**
+ * Constructs a new EntityNotFoundException exception with the specified detail message.
+ *
+ * @param message the detail message
+ */
+ public EntityNotFoundException(String message) {
+ super( message );
+ }
+
+}
/src/javax/persistence/EntityNotFoundException.java
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/DiscriminatorType.java
===================================================================
--- src/javax/persistence/DiscriminatorType.java (revision 0)
+++ src/javax/persistence/DiscriminatorType.java (revision 33)
@@ -0,0 +1,23 @@
+//$Id: DiscriminatorType.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+/**
+ * Defines supported types of the discriminator column
+ *
+ * @author Emmanuel Bernard
+ */
+public enum DiscriminatorType {
+ /**
+ * String as the discriminator type
+ */
+ STRING,
+ /**
+ * Single character as the discriminator type
+ */
+ CHAR,
+ /**
+ * Integer as the discriminator type
+ */
+ INTEGER
+};
/src/javax/persistence/DiscriminatorType.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/NamedQuery.java
===================================================================
--- src/javax/persistence/NamedQuery.java (revision 0)
+++ src/javax/persistence/NamedQuery.java (revision 33)
@@ -0,0 +1,31 @@
+//$Id: NamedQuery.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+/**
+ * Is used to specify a named query in the Java Persistence query language, which is a static
+ * query expressed in metadata. Query names are scoped to the persistence unit.
+ *
+ * @author Emmanuel Bernard
+ */
+//TODO remove the mackage target
+@Target({TYPE}) @Retention(RUNTIME)
+public @interface NamedQuery {
+ /**
+ * Refers to the query when using the EntityManager methods that create query objects.
+ */
+ String name();
+ /**
+ * The query string in the Java Persistence query language
+ */
+ String query();
+ /**
+ * Vendor-specific query hints
+ */
+ QueryHint[] hints() default {};
+}
/src/javax/persistence/NamedQuery.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/JoinColumn.java
===================================================================
--- src/javax/persistence/JoinColumn.java (revision 0)
+++ src/javax/persistence/JoinColumn.java (revision 33)
@@ -0,0 +1,67 @@
+//$Id: JoinColumn.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Is used to specify a mapped column for joining an entity association.
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({METHOD, FIELD}) @Retention(RUNTIME)
+public @interface JoinColumn {
+ /**
+ * The name of the foreign key column.
+ * The table in which it is found depends upon the context. If the join is for a OneToOne
+ * or Many- ToOne mapping, the foreign key column is in the table of the source entity.
+ * If the join is for a ManyToMany, the foreign key is in a join table. Default (only applies
+ * if a single join column is used): The concatenation of the following: the name of the referencing
+ * relationship property or field of the referencing entity; "_"; the name of the referenced primary
+ * key column. If there is no such referencing relationship property or field in the entity, the join
+ * column name is formed as the concatenation of the following: the name of the entity; "_"; the name
+ * of the referenced primary key column.
+ */
+ String name() default "";
+ /**
+ * The name of the column referenced by this foreign key column. When used with relationship mappings,
+ * the referenced column is in the table of the target entity. When used inside a JoinTable annotation,
+ * the referenced key column is in the entity table of the owning entity, or inverse entity if the join
+ * is part of the inverse join definition. Default (only applies if single join column is being used):
+ * The same name as the primary key column of the referenced table.
+ */
+ String referencedColumnName() default "";
+ /**
+ * Whether the property is a unique key. This is a shortcut for the UniqueConstraint annotation at the
+ * table level and is useful for when the unique key constraint is only a single field. It is not
+ * necessary to explicitly specify this for a join column that corresponds to a primary key that is part
+ * of a foreign key.
+ */
+ boolean unique() default false;
+ /**
+ * Whether the foreign key column is nullable
+ */
+ boolean nullable() default true;
+ /**
+ * Whether the column is included in SQL INSERT statements generated by the persistence provider
+ */
+ boolean insertable() default true;
+ /**
+ * Whether the column is included in SQL UPDATE statements generated by the persistence provider
+ */
+ boolean updatable() default true;
+ /**
+ * The SQL fragment that is used when generating the DDL for the column.
+ * Defaults to the generated SQL for the column.
+ */
+ String columnDefinition() default "";
+ /**
+ * The name of the table that contains the column. If a table is not specified, the column is
+ * assumed to be in the primary table of the applicable entity
+ */
+ String table() default "";
+}
/src/javax/persistence/JoinColumn.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/javax/persistence/SequenceGenerator.java
===================================================================
--- src/javax/persistence/SequenceGenerator.java (revision 0)
+++ src/javax/persistence/SequenceGenerator.java (revision 33)
@@ -0,0 +1,38 @@
+//$Id: SequenceGenerator.java 11282 2007-03-14 22:05:59Z epbernard $
+//EJB3 Specification Copyright 2004-2006 Sun Microsystems, Inc.
+package javax.persistence;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * This annotation defines a primary key generator that may be referenced by name when a generator
+ * element is specified for the GeneratedValue annotation. A sequence generator may be specified on
+ * the entity class or on the primary key field or property. The scope of the generator name is global
+ * to the persistence unit (across all generator types).
+ *
+ * @author Emmanuel Bernard
+ */
+@Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+public @interface SequenceGenerator {
+ /**
+ * A unique generator name that can be referenced by one or more classes to be the generator for primary key values
+ */
+ String name();
+ /**
+ * The name of the database sequence object from which to obtain primary key values
+ * Defaults to a provider-chosen value
+ */
+ String sequenceName() default "";
+ /**
+ * The value from which the sequence object is to start generating
+ */
+ int initialValue() default 1;
+ /**
+ * The amount to increment by when allocating sequence numbers from the sequence
+ */
+ int allocationSize() default 50;
+}
/src/javax/persistence/SequenceGenerator.java
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: src/ch/ffhs/webE/dao/UserDAOImpl.java
===================================================================
--- src/ch/ffhs/webE/dao/UserDAOImpl.java (revision 32)
+++ src/ch/ffhs/webE/dao/UserDAOImpl.java (revision 33)
@@ -6,129 +6,130 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
+import ch.ffhs.webE.domain.User;
+
import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
-import ch.ffhs.webE.domain.*;
public class UserDAOImpl implements UserDAO
{
- @SessionTarget
- Session session;
- @TransactionTarget
- Transaction transaction;
+ @SessionTarget
+ Session session;
+ @TransactionTarget
+ Transaction transaction;
- /**
- * Creates a list of all the registered users
- *
- * @return an ArrayList with all the users - in case of a problem, an empty
- * list is returned
- */
- @SuppressWarnings("unchecked")
- @Override
- public List<User> listUser()
+ /**
+ * Creates a list of all the registered users
+ *
+ * @return an ArrayList with all the users - in case of a problem, an empty
+ * list is returned
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<User> listUser()
+ {
+ List<User> user = null;
+ try
{
- List<User> user = null;
- try
- {
- user = session.createQuery("from User").list();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
+ user = this.session.createQuery("from User").list();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
- // If no user was checked, return an empty list to mitigate null pointer
- // exceptions
- if (user == null)
- {
- user = new ArrayList<User>();
- }
- return user;
+ // If no user was checked, return an empty list to mitigate null pointer
+ // exceptions
+ if (user == null)
+ {
+ user = new ArrayList<User>();
}
+ return user;
+ }
- /**
- * Executes the query to save the user
- *
- * @param User
- * Domain object to be saved
- * @return void
- */
- @Override
- public void saveOrUpdateUser(User user)
+ /**
+ * Executes the query to save the user
+ *
+ * @param User
+ * Domain object to be saved
+ * @return void
+ */
+ @Override
+ public void saveOrUpdateUser(User user)
+ {
+ try
{
- try
- {
- session.saveOrUpdate(user);
- }
- catch (Exception e)
- {
- transaction.rollback();
- e.printStackTrace();
- }
+ this.session.saveOrUpdate(user);
}
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ e.printStackTrace();
+ }
+ }
- /**
- * Used to delete a user.
- *
- * @param int userId
- */
- @Override
- public void deleteUser(int userId)
+ /**
+ * Used to delete a user.
+ *
+ * @param int userId
+ */
+ @Override
+ public void deleteUser(int userId)
+ {
+ try
{
- try
- {
- User user = (User) session.get(User.class, userId);
- session.delete(user);
- }
- catch (Exception e)
- {
- transaction.rollback();
- e.printStackTrace();
- }
+ User user = (User) this.session.get(User.class, userId);
+ this.session.delete(user);
}
+ catch (Exception e)
+ {
+ this.transaction.rollback();
+ e.printStackTrace();
+ }
+ }
- /**
- * Returns a single user with this user name (used for login)
- *
- * @param username
- * : String - entire user name
- * @return User: Returns a user object if something is found. If not, null
- * is returned
- */
- public User searchUsername(String username)
+ /**
+ * Returns a single user with this user name (used for login)
+ *
+ * @param username
+ * : String - entire user name
+ * @return User: Returns a user object if something is found. If not, null is
+ * returned
+ */
+ public User searchUsername(String username)
+ {
+ User user = null;
+
+ // Exec query
+ try
{
- User user = null;
-
- // Exec query
- try
- {
- user = (User) session
- .createQuery("FROM User " + "WHERE username = :username")
- .setParameter("username", username).uniqueResult();
- }
- catch (Exception e)
- {
- // TODO: Log error
- }
- return user;
+ user = (User) this.session
+ .createQuery("FROM User " + "WHERE username = :username")
+ .setParameter("username", username).uniqueResult();
}
+ catch (Exception e)
+ {
+ // TODO: Log error
+ }
+ return user;
+ }
- /**
- * Used to list a single user by Id.
- */
- @Override
- public User listUserById(int userId)
+ /**
+ * Used to list a single user by Id.
+ */
+ @Override
+ public User listUserById(int userId)
+ {
+ User user = null;
+ try
{
- User user = null;
- try
- {
- user = (User) session.get(User.class, userId);
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return user;
+ user = (User) this.session.get(User.class, userId);
}
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return user;
+ }
}
\ No newline at end of file
/trunk/src/ch/ffhs/webE/dao/TermDAO.java
17,12 → 17,6
List<Term> listTerm();
 
/**
* @param termName
* @return
*/
Term searchTerm(String termName);
 
/**
* Delete a term
*
* @param termId
31,10 → 25,12
void deleteTerm(int termId);
 
/**
* Retrieves a term by ID
*
* @param termId
* @return
*/
Term listTermById(int termId);
Term getTermById(int termId);
 
/**
* Executes the query to save the term
41,6 → 37,7
*
* @param term
* Domain object to be saved
* @return <code>true</code> if successful, <code>false</code> otherwise
*/
void saveOrUpdate(Term term);
boolean saveOrUpdate(Term term);
}
/trunk/src/ch/ffhs/webE/dao/TermDAOImpl.java
42,7 → 42,7
List<Term> term = null;
try
{
term = this.session.createQuery("FROM term").list(); //$NON-NLS-1$
term = this.session.createQuery("from Term").list(); //$NON-NLS-1$
}
catch (Exception e)
{
57,6 → 57,7
{
term = new ArrayList<Term>();
}
 
return term;
}
 
65,16 → 66,19
*
* @see ch.ffhs.webE.dao.TermDAO#saveOrUpdate(ch.ffhs.webE.domain.Term)
*/
public void saveOrUpdate(Term term)
public boolean saveOrUpdate(Term term)
{
try
{
term.setObjectId(term.getObjectId());
this.session.saveOrUpdate(term);
return true;
}
catch (Exception e)
{
this.transaction.rollback();
e.printStackTrace();
return false;
}
}
 
87,8 → 91,8
{
try
{
Term user = (Term) this.session.get(Term.class, termId);
this.session.delete(user);
Term term = (Term) this.session.get(Term.class, termId);
this.session.delete(term);
}
catch (Exception e)
{
97,43 → 101,17
}
}
 
/**
* Returns a single user with this user name (used for login)
/*
* (non-Javadoc)
*
* @param termName
* Term name
* @return User: Returns a user object if something is found. If not, null is
* returned
* @see ch.ffhs.webE.dao.TermDAO#getTermById(int)
*/
public Term searchTerm(String termName)
public Term getTermById(int termId)
{
Term term = null;
 
/* Exec query */
try
{
term = (Term) this.session
.createQuery("FROM User " + "WHERE username = :username") //$NON-NLS-1$ //$NON-NLS-2$
.setParameter("username", termName).uniqueResult(); //$NON-NLS-1$
}
catch (Exception e)
{
/* TODO: Log error */
}
return term;
}
 
/**
* List a term by ID
*
* @param termId
* @return
*/
public Term listTermById(int termId)
{
Term term = null;
try
{
term = (Term) this.session.get(Term.class, termId);
}
catch (Exception e)
140,6 → 118,7
{
e.printStackTrace();
}
 
return term;
}
}
/trunk/src/ch/ffhs/webE/domain/Object.java
File deleted
/trunk/src/ch/ffhs/webE/domain/User.java
2,13 → 2,15
 
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
 
import static javax.persistence.GenerationType.IDENTITY;
 
import java.util.HashSet;
import java.util.Set;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
19,121 → 21,147
*/
@Entity
@Table(name = "user", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "username"))
public class User implements java.io.Serializable {
public class User implements java.io.Serializable
{
/**
* Version ID for serialization
*/
private static final long serialVersionUID = 1L;
 
private Integer id;
private String username;
private String password;
private String firstname;
private String lastname;
private boolean admin;
private Set<Object> objectsForOwnerId = new HashSet<Object>(0);
private Set<Object> objectsForEditorId = new HashSet<Object>(0);
private Set<History> histories = new HashSet<History>(0);
private Integer id;
private String username;
private String password;
private String firstname;
private String lastname;
private boolean admin;
private Set<ObjectEntity> objectsForOwnerId = new HashSet<ObjectEntity>(0);
private Set<ObjectEntity> objectsForEditorId = new HashSet<ObjectEntity>(0);
private Set<History> histories = new HashSet<History>(0);
 
public User() {
}
public User()
{
}
 
public User(String username, String password, boolean admin) {
this.username = username;
this.password = password;
this.admin = admin;
}
public User(String username, String password, boolean admin)
{
this.username = username;
this.password = password;
this.admin = admin;
}
 
public User(String username, String password, String firstname,
String lastname, boolean admin, Set<Object> objectsForOwnerId,
Set<Object> objectsForEditorId, Set<History> histories) {
this.username = username;
this.password = password;
this.firstname = firstname;
this.lastname = lastname;
this.admin = admin;
this.objectsForOwnerId = objectsForOwnerId;
this.objectsForEditorId = objectsForEditorId;
this.histories = histories;
}
public User(String username, String password, String firstname,
String lastname, boolean admin, Set<ObjectEntity> objectsForOwnerId,
Set<ObjectEntity> objectsForEditorId, Set<History> histories)
{
this.username = username;
this.password = password;
this.firstname = firstname;
this.lastname = lastname;
this.admin = admin;
this.objectsForOwnerId = objectsForOwnerId;
this.objectsForEditorId = objectsForEditorId;
this.histories = histories;
}
 
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId()
{
return this.id;
}
 
public void setId(Integer id) {
this.id = id;
}
public void setId(Integer id)
{
this.id = id;
}
 
@Column(name = "username", unique = true, nullable = false)
public String getUsername() {
return this.username;
}
@Column(name = "username", unique = true, nullable = false)
public String getUsername()
{
return this.username;
}
 
public void setUsername(String username) {
this.username = username;
}
public void setUsername(String username)
{
this.username = username;
}
 
@Column(name = "password", nullable = false, length = 32)
public String getPassword() {
return this.password;
}
@Column(name = "password", nullable = false, length = 32)
public String getPassword()
{
return this.password;
}
 
public void setPassword(String password) {
this.password = password;
}
public void setPassword(String password)
{
this.password = password;
}
 
@Column(name = "firstname", length = 45)
public String getFirstname() {
return this.firstname;
}
@Column(name = "firstname", length = 45)
public String getFirstname()
{
return this.firstname;
}
 
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public void setFirstname(String firstname)
{
this.firstname = firstname;
}
 
@Column(name = "lastname", length = 45)
public String getLastname() {
return this.lastname;
}
@Column(name = "lastname", length = 45)
public String getLastname()
{
return this.lastname;
}
 
public void setLastname(String lastname) {
this.lastname = lastname;
}
public void setLastname(String lastname)
{
this.lastname = lastname;
}
 
@Column(name = "admin", nullable = false)
public boolean isAdmin() {
return this.admin;
}
@Column(name = "admin", nullable = false)
public boolean isAdmin()
{
return this.admin;
}
 
public void setAdmin(boolean admin) {
this.admin = admin;
}
public void setAdmin(boolean admin)
{
this.admin = admin;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByOwnerId")
public Set<Object> getObjectsForOwnerId() {
return this.objectsForOwnerId;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByOwnerId")
public Set<ObjectEntity> getObjectsForOwnerId()
{
return this.objectsForOwnerId;
}
 
public void setObjectsForOwnerId(Set<Object> objectsForOwnerId) {
this.objectsForOwnerId = objectsForOwnerId;
}
public void setObjectsForOwnerId(Set<ObjectEntity> objectsForOwnerId)
{
this.objectsForOwnerId = objectsForOwnerId;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByEditorId")
public Set<Object> getObjectsForEditorId() {
return this.objectsForEditorId;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByEditorId")
public Set<ObjectEntity> getObjectsForEditorId()
{
return this.objectsForEditorId;
}
 
public void setObjectsForEditorId(Set<Object> objectsForEditorId) {
this.objectsForEditorId = objectsForEditorId;
}
public void setObjectsForEditorId(Set<ObjectEntity> objectsForEditorId)
{
this.objectsForEditorId = objectsForEditorId;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
public Set<History> getHistories() {
return this.histories;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
public Set<History> getHistories()
{
return this.histories;
}
 
public void setHistories(Set<History> histories) {
this.histories = histories;
}
public void setHistories(Set<History> histories)
{
this.histories = histories;
}
 
}
/trunk/src/ch/ffhs/webE/domain/History.java