HHH-5367 - Move annotations module sources into core module
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19921 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
cc3b41a09c
commit
1ca2bc19a5
|
@ -105,6 +105,7 @@
|
|||
<groupId>org.jboss.maven.plugins</groupId>
|
||||
<artifactId>maven-test-ext-plugin</artifactId>
|
||||
</plugin>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.jboss.maven.plugins</groupId>
|
||||
<artifactId>maven-injection-plugin</artifactId>
|
||||
|
@ -122,6 +123,7 @@
|
|||
</bytecodeInjections>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
<plugin>
|
||||
<groupId>org.twdata.maven</groupId>
|
||||
<artifactId>maven-cli-plugin</artifactId>
|
||||
|
|
|
@ -1,170 +0,0 @@
|
|||
/*
|
||||
* 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.type;
|
||||
|
||||
import java.io.CharArrayReader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.usertype.UserType;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
|
||||
/**
|
||||
* Map a Character[] to a Clob
|
||||
* Experimental
|
||||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class CharacterArrayClobType implements UserType, Serializable {
|
||||
public static final int BUFFER_SIZE = 4096;
|
||||
|
||||
public int[] sqlTypes() {
|
||||
return new int[]{Types.CLOB};
|
||||
}
|
||||
|
||||
public Class returnedClass() {
|
||||
return Character[].class;
|
||||
}
|
||||
|
||||
public boolean equals(Object x, Object y) throws HibernateException {
|
||||
if ( x == y ) return true;
|
||||
if ( x == null || y == null ) return false;
|
||||
if ( x instanceof Character[] ) {
|
||||
Object[] o1 = (Object[]) x;
|
||||
Object[] o2 = (Object[]) y;
|
||||
return ArrayHelper.isEquals( o1, o2 );
|
||||
}
|
||||
else {
|
||||
char[] c1 = (char[]) x;
|
||||
char[] c2 = (char[]) y;
|
||||
return ArrayHelper.isEquals( c1, c2 );
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode(Object x) throws HibernateException {
|
||||
if ( x instanceof Character[] ) {
|
||||
Object[] o = (Object[]) x;
|
||||
return ArrayHelper.hash( o );
|
||||
}
|
||||
else {
|
||||
char[] c = (char[]) x;
|
||||
return ArrayHelper.hash( c );
|
||||
}
|
||||
}
|
||||
|
||||
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
|
||||
Reader reader = rs.getCharacterStream( names[0] );
|
||||
if ( reader == null ) return null;
|
||||
ArrayList result = new ArrayList();
|
||||
try {
|
||||
char[] charbuf = new char[BUFFER_SIZE];
|
||||
for ( int i = reader.read( charbuf ); i > 0 ; i = reader.read( charbuf ) ) {
|
||||
result.ensureCapacity( result.size() + BUFFER_SIZE );
|
||||
for ( int charIndex = 0; charIndex < i ; charIndex++ ) {
|
||||
result.add( Character.valueOf( charbuf[charIndex] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new SQLException( e.getMessage() );
|
||||
}
|
||||
if ( returnedClass().equals( Character[].class ) ) {
|
||||
return result.toArray( new Character[ result.size() ] );
|
||||
}
|
||||
else {
|
||||
//very suboptimal
|
||||
int length = result.size();
|
||||
char[] chars = new char[length];
|
||||
for ( int index = 0; index < length ; index++ ) {
|
||||
chars[index] = ( (Character) result.get( index ) ).charValue();
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
}
|
||||
|
||||
public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
|
||||
if ( value != null ) {
|
||||
char[] chars;
|
||||
if ( value instanceof Character[] ) {
|
||||
Character[] character = (Character[]) value;
|
||||
int length = character.length;
|
||||
chars = new char[length];
|
||||
for ( int i = 0; i < length ; i++ ) {
|
||||
chars[i] = character[i].charValue();
|
||||
}
|
||||
}
|
||||
else {
|
||||
chars = (char[]) value;
|
||||
}
|
||||
CharArrayReader reader = new CharArrayReader( chars );
|
||||
st.setCharacterStream( index, reader, chars.length );
|
||||
}
|
||||
else {
|
||||
st.setNull( index, sqlTypes()[0] );
|
||||
}
|
||||
}
|
||||
|
||||
public Object deepCopy(Object value) throws HibernateException {
|
||||
if ( value == null ) return null;
|
||||
if ( value instanceof Character[] ) {
|
||||
Character[] array = (Character[]) value;
|
||||
int length = array.length;
|
||||
Character[] copy = new Character[length];
|
||||
for ( int index = 0; index < length ; index++ ) {
|
||||
copy[index] = Character.valueOf( array[index].charValue() );
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
else {
|
||||
char[] array = (char[]) value;
|
||||
int length = array.length;
|
||||
char[] copy = new char[length];
|
||||
System.arraycopy( array, 0, copy, 0, length );
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Serializable disassemble(Object value) throws HibernateException {
|
||||
return (Serializable) deepCopy( value );
|
||||
}
|
||||
|
||||
public Object assemble(Serializable cached, Object owner) throws HibernateException {
|
||||
return deepCopy( cached );
|
||||
}
|
||||
|
||||
public Object replace(Object original, Object target, Object owner) throws HibernateException {
|
||||
return deepCopy( original );
|
||||
}
|
||||
}
|
|
@ -3,8 +3,6 @@ package org.hibernate.test.annotations.cid;
|
|||
import java.io.Serializable;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
import org.hibernate.annotations.*;
|
||||
|
||||
/**
|
||||
* @author bartek
|
||||
*/
|
||||
|
|
|
@ -21,7 +21,6 @@ import javax.persistence.OrderColumn;
|
|||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.CollectionOfElements;
|
||||
import org.hibernate.test.annotations.collectionelement.FavoriteFood;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.io.Serializable;
|
|||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.MapKeyColumn;
|
||||
|
@ -13,7 +12,6 @@ import javax.persistence.MapKeyColumn;
|
|||
import org.hibernate.annotations.Fetch;
|
||||
import org.hibernate.annotations.FetchMode;
|
||||
import org.hibernate.annotations.Filter;
|
||||
import org.hibernate.annotations.MapKey;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
package org.hibernate.test.annotations.embedded;
|
||||
|
||||
import javax.persistence.AttributeOverride;
|
||||
import javax.persistence.AttributeOverrides;
|
||||
import javax.persistence.CollectionTable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
|
@ -24,14 +24,9 @@
|
|||
package org.hibernate.test.annotations.idclassgeneratedvalue;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
/**
|
||||
* A Simple entity class.
|
||||
|
|
|
@ -28,7 +28,6 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.IdClass;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
//$Id$
|
||||
package org.hibernate.test.annotations.immutable;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -11,12 +9,8 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.cfg.AnnotationConfiguration;
|
||||
import org.hibernate.dialect.SQLServerDialect;
|
||||
import org.hibernate.test.annotations.TestCase;
|
||||
import org.hibernate.test.annotations.fkcircularity.A;
|
||||
import org.hibernate.test.annotations.fkcircularity.B;
|
||||
import org.hibernate.test.annotations.fkcircularity.C;
|
||||
import org.hibernate.test.annotations.fkcircularity.D;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.JoinColumn;
|
||||
|
||||
import org.hibernate.annotations.Index;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
//$Id$
|
||||
package org.hibernate.test.annotations.manytomany;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OrderBy;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.hibernate.annotations.FilterDef;
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.hibernate.test.annotations.manytoone;
|
|||
|
||||
import java.util.Set;
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.hibernate.test.annotations.onetoone;
|
|||
|
||||
import org.hibernate.cfg.AnnotationConfiguration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.test.annotations.IncorrectEntity;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.AnnotationException;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.hibernate.test.annotations.onetoone.hhh4851;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.DiscriminatorType;
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
|
@ -10,14 +8,9 @@ import javax.persistence.FetchType;
|
|||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cascade;
|
||||
import org.hibernate.annotations.CascadeType;
|
||||
|
||||
@Entity
|
||||
@Table
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
|
|
|
@ -11,7 +11,6 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.Id;
|
||||
import javax.persistence.CollectionTable;
|
||||
|
||||
import org.hibernate.annotations.MapKey;
|
||||
import org.hibernate.annotations.CollectionOfElements;
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.HashSet;
|
|||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.NamedNativeQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.JoinColumn;
|
||||
|
|
|
@ -9,9 +9,7 @@ import javax.persistence.GeneratedValue;
|
|||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.MapKeyClass;
|
||||
import javax.persistence.JoinColumn;
|
||||
|
||||
import org.hibernate.annotations.MapKey;
|
||||
import org.hibernate.annotations.MapKeyManyToMany;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,6 @@ package org.hibernate.test.annotations.target;
|
|||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Embedded;
|
||||
|
||||
import org.hibernate.annotations.Target;
|
||||
|
|
13
core/pom.xml
13
core/pom.xml
|
@ -30,6 +30,19 @@
|
|||
<groupId>dom4j</groupId>
|
||||
<artifactId>dom4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-commons-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate.javax.persistence</groupId>
|
||||
<artifactId>hibernate-jpa-2.0-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- optional deps for bytecode providers until those are finally properly scoped -->
|
||||
<dependency>
|
||||
|
|
|
@ -59,7 +59,7 @@ public @interface Any {
|
|||
* 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;
|
||||
FetchType fetch() default FetchType.EAGER;
|
||||
/**
|
||||
* Whether the association is optional. If set to false then a non-null relationship must always exist.
|
||||
*/
|
|
@ -48,5 +48,5 @@ public @interface CollectionOfElements {
|
|||
*/
|
||||
Class targetElement() default void.class;
|
||||
|
||||
FetchType fetch() default LAZY;
|
||||
FetchType fetch() default FetchType.LAZY;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// $Id:$
|
||||
// $Id$
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
|
@ -1,4 +1,4 @@
|
|||
// $Id:$
|
||||
// $Id$
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
|
@ -59,5 +59,5 @@ public @interface ManyToAny {
|
|||
* 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;
|
||||
FetchType fetch() default FetchType.EAGER;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue