[hibernate/hibernate-orm] ab64f5: HHH-7552 - New StrategySelectorService : initial a...
by GitHub
Branch: refs/heads/master
Home: https://github.com/hibernate/hibernate-orm
Commit: ab64f5c3be0fbe757b49dfa7a39d9c2bf9903d80
https://github.com/hibernate/hibernate-orm/commit/ab64f5c3be0fbe757b49dfa...
Author: Steve Ebersole <steve(a)hibernate.org>
Date: 2012-08-31 (Fri, 31 Aug 2012)
Changed paths:
M hibernate-core/src/main/java/org/hibernate/boot/registry/BootstrapServiceRegistryBuilder.java
A hibernate-core/src/main/java/org/hibernate/boot/registry/selector/Availability.java
A hibernate-core/src/main/java/org/hibernate/boot/registry/selector/AvailabilityAnnouncer.java
A hibernate-core/src/main/java/org/hibernate/boot/registry/selector/SimpleAvailabilityImpl.java
M hibernate-core/src/main/java/org/hibernate/boot/registry/selector/internal/StrategySelectorBuilder.java
M hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java
M hibernate-core/src/main/java/org/hibernate/cache/internal/RegionFactoryInitiator.java
A hibernate-ehcache/src/main/java/org/hibernate/cache/ehcache/AvailabilityAnnouncerImpl.java
A hibernate-ehcache/src/main/resources/META-INF/services/org.hibernate.boot.registry.selector.AvailabilityAnnouncer
A hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/AvailabilityAnnouncerImpl.java
A hibernate-infinispan/src/main/resources/META-INF/services/org.hibernate.boot.registry.selector.AvailabilityAnnouncer
Log Message:
-----------
HHH-7552 - New StrategySelectorService : initial auto-detection
12 years, 2 months
[hibernate/hibernate-orm] d7fdf2: HHH-7322 Refactoring of unidirectional one to many...
by GitHub
Branch: refs/heads/metamodel
Home: https://github.com/hibernate/hibernate-orm
Commit: d7fdf278dfc0756064a8a9326238c26af8f0cbfb
https://github.com/hibernate/hibernate-orm/commit/d7fdf278dfc0756064a8a93...
Author: Hardy Ferentschik <hardy(a)hibernate.org>
Date: 2012-08-31 (Fri, 31 Aug 2012)
Changed paths:
M build.gradle
M hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java
M hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java
M hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/AbstractBasicBindingTests.java
A hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/AbstractUnidirectionalOneToManyBindingTests.java
A hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/AnnotationUnidirectionalOneToManyBindingTests.java
M hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.java
A hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/HbmUnidirectionalOneToManyBindingTests.java
A hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/ReferencedEntity.java
R hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java
M hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.hbm.xml
A hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/onetomany/ReferencedEntity.hbm.xml
M libraries.gradle
Log Message:
-----------
HHH-7322 Refactoring of unidirectional one to many test to cater for hbm and annotations
Adding some error handling in Binder for the case that not all configuration sources are added
Upgrading JBoss logging
12 years, 2 months
Hibernate SVN: r21066 - annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: brmeyer
Date: 2012-08-30 19:34:53 -0400 (Thu, 30 Aug 2012)
New Revision: 21066
Added:
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/EntityMapTest.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapHolder.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapKey.java
annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapValue.java
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentMap.java
Log:
JBPAPP-9792 HHH-7557 Map entries get deleted
Added: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/EntityMapTest.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/EntityMapTest.java (rev 0)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/EntityMapTest.java 2012-08-30 23:34:53 UTC (rev 21066)
@@ -0,0 +1,103 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.test.collection.map.hhh7557;
+
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.hibernate.Session;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * @author Elizabeth Chatman
+ * @author Steve Ebersole
+ */
+public class EntityMapTest extends TestCase {
+
+ @Override
+ protected Class<?>[] getAnnotatedClasses() {
+ return new Class[] {MapValue.class, MapKey.class, MapHolder.class};
+ }
+
+ public void testInsertIntoMap() throws Exception {
+ {
+ // Session 1: Insert 3 values into the map
+ Session session = openSession();
+ session.beginTransaction();
+ MapHolder mapHolder = new MapHolder();
+ mapHolder.setMap( new HashMap<MapKey, MapValue>() );
+ addMapEntry( session, mapHolder, "A", "1" );
+ addMapEntry( session, mapHolder, "B", "2" );
+ addMapEntry( session, mapHolder, "C", "3" );
+ session.save( mapHolder );
+ // Verify there are 3 entries in the map
+ Assert.assertEquals( 3, mapHolder.getMap().size() );
+ session.getTransaction().commit();
+ session.close();
+ }
+
+ {
+ // Session 2: Add a 4th value to the map
+ Session session = openSession();
+ session.beginTransaction();
+ MapHolder mapHolder = getMapHolder( session );
+ System.out.println( "Got MapHolder; checking map size -----" );
+ Assert.assertEquals( 3, mapHolder.getMap().size() );
+ System.out.println( "Got MapHolder; checked map size -----" );
+ addMapEntry( session, mapHolder, "D", "4" );
+ // Verify there are 4 entries in the map
+ Assert.assertEquals( 4, mapHolder.getMap().size() );
+ session.getTransaction().commit();
+ session.close();
+ }
+
+ {
+ // Session 3: Count the entries in the map
+ Session session = openSession();
+ session.beginTransaction();
+ MapHolder mapHolder = getMapHolder( session );
+ // Fails here (expected:<4> but was:<1>)
+ Assert.assertEquals( 4, mapHolder.getMap().size() );
+ session.getTransaction().commit();
+ session.close();
+ }
+ }
+
+ private void addMapEntry(Session session, MapHolder mapHolder, String key, String value) {
+ System.out.println( "Inserting (" + key + "," + value + ") into map" );
+ MapValue entityValue = new MapValue( value );
+ session.save( entityValue );
+ MapKey entityKey = new MapKey( key, entityValue );
+ session.save( entityKey );
+ mapHolder.getMap().put( entityKey, entityValue );
+ }
+
+ private MapHolder getMapHolder(Session session) {
+ List mapHolders = session.createQuery( "select distinct mh from MapHolder mh" ).list();
+ Assert.assertEquals( 1, mapHolders.size() );
+ return (MapHolder) mapHolders.get( 0 );
+ }
+}
Added: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapHolder.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapHolder.java (rev 0)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapHolder.java 2012-08-30 23:34:53 UTC (rev 21066)
@@ -0,0 +1,80 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.test.collection.map.hhh7557;
+
+import java.util.Map;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+
+/**
+ * @author Elizabeth Chatman
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "map_holder")
+public class MapHolder {
+ private Long id;
+ private Map<MapKey, MapValue> map;
+
+ @Id
+ @GeneratedValue
+ @Column(name = "id", unique = true, nullable = false)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @ManyToMany
+ @JoinTable(
+ name = "map_key_map_value",
+ joinColumns = @JoinColumn(name = "map_holder_id", nullable = false),
+ inverseJoinColumns = @JoinColumn(name = "map_value_id", nullable = false)
+ )
+// @MapKeyJoinColumn(name = "map_key_id", nullable = false)
+ public Map<MapKey, MapValue> getMap() {
+ return map;
+ }
+
+ public void setMap(Map<MapKey, MapValue> map) {
+ this.map = map;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append( "MapHolder [id=" ).append( id ).append( "]" );
+ return builder.toString();
+ }
+
+}
Added: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapKey.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapKey.java (rev 0)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapKey.java 2012-08-30 23:34:53 UTC (rev 21066)
@@ -0,0 +1,137 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.test.collection.map.hhh7557;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+
+/**
+ * @author Elizabeth Chatman
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "map_key", uniqueConstraints = {
+ @UniqueConstraint(columnNames = {"name", "default_map_value_id"})
+})
+public class MapKey {
+ private Long id;
+ private String name;
+ private MapValue defaultValue;
+
+ public MapKey() {
+ }
+
+ public MapKey(String name, MapValue defaultValue) {
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ @Id
+ @GeneratedValue
+ @Column(name = "id", unique = true, nullable = false)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "name", nullable = false)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "default_map_value_id", nullable = false)
+ public MapValue getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(MapValue defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getDefaultValue() == null) ? 0 : getDefaultValue().hashCode());
+ result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( this == obj ) {
+ return true;
+ }
+ if ( obj == null ) {
+ return false;
+ }
+ if ( !(obj instanceof MapKey) ) {
+ return false;
+ }
+ MapKey other = (MapKey) obj;
+ if ( getDefaultValue() == null ) {
+ if ( other.getDefaultValue() != null ) {
+ return false;
+ }
+ }
+ else if ( !getDefaultValue().equals( other.getDefaultValue() ) ) {
+ return false;
+ }
+ if ( getName() == null ) {
+ if ( other.getName() != null ) {
+ return false;
+ }
+ }
+ else if ( !getName().equals( other.getName() ) ) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append( "MapKey [id=" ).append( getId() )
+ .append( ", name=" ).append( getName() )
+ .append( ", defaultValue=" ).append( getDefaultValue() )
+ .append( "]" );
+ return builder.toString();
+ }
+
+}
\ No newline at end of file
Added: annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapValue.java
===================================================================
--- annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapValue.java (rev 0)
+++ annotations/branches/v3_4_0_GA_CP/src/test/java/org/hibernate/test/collection/map/hhh7557/MapValue.java 2012-08-30 23:34:53 UTC (rev 21066)
@@ -0,0 +1,110 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.test.collection.map.hhh7557;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+/**
+ * @author Elizabeth Chatman
+ * @author Steve Ebersole
+ */
+@Entity
+@Table(name = "map_value")
+public class MapValue {
+ private Long id;
+ private String name;
+
+ public MapValue() {
+ }
+
+ public MapValue(String name) {
+ this.name = name;
+ }
+
+ @Id
+ @GeneratedValue
+ @Column(name = "id", unique = true, nullable = false)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ @Column(name = "name", unique = true, nullable = false)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ int previousHashCode = -1;
+
+ @Override
+ public int hashCode() {
+
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
+ previousHashCode = result;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( this == obj ) {
+ return true;
+ }
+ if ( obj == null ) {
+ return false;
+ }
+ if ( !(obj instanceof MapValue) ) {
+ return false;
+ }
+ MapValue other = (MapValue) obj;
+ if ( getName() == null ) {
+ if ( other.getName() != null ) {
+ return false;
+ }
+ }
+ else if ( !getName().equals( other.getName() ) ) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append( "MapValue [id=" ).append( getId() ).append( ", name=" ).append( getName() ).append( "]" );
+ return builder.toString();
+ }
+}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentMap.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentMap.java 2012-08-30 16:55:39 UTC (rev 21065)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/collection/PersistentMap.java 2012-08-30 23:34:53 UTC (rev 21066)
@@ -275,14 +275,35 @@
return map.toString();
}
- public Object readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
- throws HibernateException, SQLException {
- Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
- Object index = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
- if ( element!=null ) map.put(index, element);
+ private transient List<Object[]> loadingEntries;
+
+ public Object readFrom(
+ ResultSet rs,
+ CollectionPersister persister,
+ CollectionAliases descriptor,
+ Object owner) throws HibernateException, SQLException {
+ final Object element = persister.readElement( rs, owner, descriptor.getSuffixedElementAliases(), getSession() );
+ if ( element != null ) {
+ final Object index = persister.readIndex( rs, descriptor.getSuffixedIndexAliases(), getSession() );
+ if ( loadingEntries == null ) {
+ loadingEntries = new ArrayList<Object[]>();
+ }
+ loadingEntries.add( new Object[] { index, element } );
+ }
return element;
}
+ @Override
+ @SuppressWarnings("unchecked")
+ public boolean endRead() {
+ if ( loadingEntries != null ) {
+ for ( Object[] entry : loadingEntries ) {
+ map.put( entry[0], entry[1] );
+ }
+ }
+ return super.endRead();
+ }
+
public Iterator entries(CollectionPersister persister) {
return map.entrySet().iterator();
}
12 years, 2 months
Hibernate SVN: r21065 - annotations/patches/JBPAPP-6940/jdbc and 12 other directories.
by hibernate-commits@lists.jboss.org
Author: brmeyer
Date: 2012-08-30 12:55:39 -0400 (Thu, 30 Aug 2012)
New Revision: 21065
Added:
core/patches/JBPAPP-6940/grammar/order-by-render.g
core/patches/JBPAPP-6940/grammar/order-by.g
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/CollationSpecification.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnMapper.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnReference.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Factory.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/FormulaReference.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Node.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/NodeSupport.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByAliasResolver.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragment.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByTranslation.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderingSpecification.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortKey.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortSpecification.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SqlValueReference.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/TranslationContext.java
Modified:
annotations/patches/JBPAPP-6940/
annotations/patches/JBPAPP-6940/jdbc/
annotations/patches/JBPAPP-6940/src/java/org/hibernate/cfg/annotations/CollectionBinder.java
annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java
core/patches/JBPAPP-6940/
core/patches/JBPAPP-6940/build.xml
core/patches/JBPAPP-6940/src/org/hibernate/hql/ast/util/ASTPrinter.java
core/patches/JBPAPP-6940/src/org/hibernate/persister/collection/AbstractCollectionPersister.java
core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/AbstractEntityPersister.java
core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java
core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Loadable.java
core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Queryable.java
core/patches/JBPAPP-6940/src/org/hibernate/sql/Template.java
core/patches/JBPAPP-6940/src/org/hibernate/util/StringHelper.java
Log:
JBPAPP-6940 ManyToManyTest.testOrderByContractor fails on DB2 and Sybase
Property changes on: annotations/patches/JBPAPP-6940
___________________________________________________________________
Added: svn:ignore
+ .settings
build
.classpath
.project
Property changes on: annotations/patches/JBPAPP-6940/jdbc
___________________________________________________________________
Added: svn:ignore
+ db2jcc_license_cu.jar
db2jcc.jar
sqlj.zip
Modified: annotations/patches/JBPAPP-6940/src/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
--- annotations/patches/JBPAPP-6940/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ annotations/patches/JBPAPP-6940/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -1,12 +1,10 @@
package org.hibernate.cfg.annotations;
-import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import java.util.StringTokenizer;
+
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Embeddable;
@@ -78,9 +76,7 @@
import org.hibernate.mapping.ManyToOne;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
-import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Table;
import org.hibernate.util.StringHelper;
@@ -817,186 +813,33 @@
}
}
- private static String buildOrderByClauseFromHql(String hqlOrderBy, PersistentClass associatedClass, String role) {
- String orderByString = null;
- if ( hqlOrderBy != null ) {
- List<String> properties = new ArrayList<String>();
- List<String> ordering = new ArrayList<String>();
- StringBuilder orderByBuffer = new StringBuilder();
- if ( hqlOrderBy.length() == 0 ) {
+ private static String buildOrderByClauseFromHql(String orderByFragment, PersistentClass associatedClass, String role) {
+ if ( orderByFragment != null ) {
+ if ( orderByFragment.length() == 0 ) {
//order by id
- Iterator it = associatedClass.getIdentifier().getColumnIterator();
- while ( it.hasNext() ) {
- Selectable col = (Selectable) it.next();
- orderByBuffer.append( col.getText() ).append( " asc" ).append( ", " );
- }
+ return "id asc";
}
- else {
- StringTokenizer st = new StringTokenizer( hqlOrderBy, " ,", false );
- String currentOrdering = null;
- //FIXME make this code decent
- while ( st.hasMoreTokens() ) {
- String token = st.nextToken();
- if ( isNonPropertyToken( token ) ) {
- if ( currentOrdering != null ) {
- throw new AnnotationException(
- "Error while parsing HQL orderBy clause: " + hqlOrderBy
- + " (" + role + ")"
- );
- }
- currentOrdering = token;
- }
- else {
- //Add ordering of the previous
- if ( currentOrdering == null ) {
- //default ordering
- ordering.add( "asc" );
- }
- else {
- ordering.add( currentOrdering );
- currentOrdering = null;
- }
- properties.add( token );
- }
- }
- ordering.remove( 0 ); //first one is the algorithm starter
- // add last one ordering
- if ( currentOrdering == null ) {
- //default ordering
- ordering.add( "asc" );
- }
- else {
- ordering.add( currentOrdering );
- currentOrdering = null;
- }
- int index = 0;
-
- for (String property : properties) {
- Property p = BinderHelper.findPropertyByName( associatedClass, property );
- if ( p == null ) {
- throw new AnnotationException(
- "property from @OrderBy clause not found: "
- + associatedClass.getEntityName() + "." + property
- );
- }
- PersistentClass pc = p.getPersistentClass();
- String table;
- if ( pc == null ) {
- //we are touching a @IdClass property, the pc is not set
- //this means pc == associatedClass
- //TODO check whether @ManyToOne @JoinTable in @IdClass used for @OrderBy works: doh!
- table = "";
- }
- else if (pc == associatedClass
- || (associatedClass instanceof SingleTableSubclass && pc
- .getMappedClass().isAssignableFrom(
- associatedClass.getMappedClass()))) {
- table = "";
- } else {
- table = pc.getTable().getQuotedName() + ".";
- }
- Iterator propertyColumns = p.getColumnIterator();
- while ( propertyColumns.hasNext() ) {
- Selectable column = (Selectable) propertyColumns.next();
- orderByBuffer.append( table )
- .append( column.getText() )
- .append( " " )
- .append( ordering.get( index ) )
- .append( ", " );
- }
- index++;
- }
+ else if ( "desc".equals( orderByFragment ) ) {
+ return "id desc";
}
- orderByString = orderByBuffer.substring( 0, orderByBuffer.length() - 2 );
}
- return orderByString;
+ return orderByFragment;
}
- private static String buildOrderByClauseFromHql(String hqlOrderBy, Component component, String role) {
- String orderByString = null;
- if ( hqlOrderBy != null ) {
- List<String> properties = new ArrayList<String>();
- List<String> ordering = new ArrayList<String>();
- StringBuilder orderByBuffer = new StringBuilder();
- if ( hqlOrderBy.length() == 0 ) {
- //TODO : Check that. Maybe order by key for maps
+ private static String adjustUserSuppliedValueCollectionOrderingFragment(String orderByFragment) {
+ if ( orderByFragment != null ) {
+ // NOTE: "$element$" is a specially recognized collection property recognized by the collection persister
+ if ( orderByFragment.length() == 0 ) {
+ //order by element
+ return "$element$ asc";
}
- else {
- StringTokenizer st = new StringTokenizer( hqlOrderBy, " ,", false );
- String currentOrdering = null;
- //FIXME make this code decent
- while ( st.hasMoreTokens() ) {
- String token = st.nextToken();
- if ( isNonPropertyToken( token ) ) {
- if ( currentOrdering != null ) {
- throw new AnnotationException(
- "Error while parsing HQL orderBy clause: " + hqlOrderBy
- + " (" + role + ")"
- );
- }
- currentOrdering = token;
- }
- else {
- //Add ordering of the previous
- if ( currentOrdering == null ) {
- //default ordering
- ordering.add( "asc" );
- }
- else {
- ordering.add( currentOrdering );
- currentOrdering = null;
- }
- properties.add( token );
- }
- }
- ordering.remove( 0 ); //first one is the algorithm starter
- // add last one ordering
- if ( currentOrdering == null ) {
- //default ordering
- ordering.add( "asc" );
- }
- else {
- ordering.add( currentOrdering );
- currentOrdering = null;
- }
- int index = 0;
-
- for (String property : properties) {
- Property p = component.getProperty( property );
- if ( p == null ) {
- throw new AnnotationException(
- "property from @OrderBy clause not found: "
- + role + "." + property
- );
- }
-
- Iterator propertyColumns = p.getColumnIterator();
- while ( propertyColumns.hasNext() ) {
- Selectable column = (Selectable) propertyColumns.next();
- orderByBuffer.append( column.getText() )
- .append( " " )
- .append( ordering.get( index ) )
- .append( ", " );
- }
- index++;
- }
-
- if ( orderByBuffer.length() >= 2 ) {
- orderByString = orderByBuffer.substring( 0, orderByBuffer.length() - 2 );
- }
+ else if ( "desc".equals( orderByFragment ) ) {
+ return "$element$ desc";
}
}
- return orderByString;
+ return orderByFragment;
}
- private static boolean isNonPropertyToken(String token) {
- if ( " ".equals( token ) ) return true;
- if ( ",".equals( token ) ) return true;
- if ( token.equalsIgnoreCase( "desc" ) ) return true;
- if ( token.equalsIgnoreCase( "asc" ) ) return true;
- return false;
- }
-
private static SimpleValue buildCollectionKey(
Collection collValue, Ejb3JoinColumn[] joinColumns, boolean cascadeDeleteEnabled,
XProperty property, ExtendedMappings mappings
@@ -1265,7 +1108,7 @@
if ( StringHelper.isNotEmpty( hqlOrderBy ) ) {
String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
- String orderBy = buildOrderByClauseFromHql( hqlOrderBy, component, path );
+ String orderBy = adjustUserSuppliedValueCollectionOrderingFragment( hqlOrderBy );
if ( orderBy != null ) {
collValue.setOrderBy( orderBy );
}
@@ -1296,6 +1139,10 @@
elementBinder.setColumns( elementColumns );
elementBinder.setType( property, elementClass );
collValue.setElement( elementBinder.make() );
+ String orderBy = adjustUserSuppliedValueCollectionOrderingFragment( hqlOrderBy );
+ if ( orderBy != null ) {
+ collValue.setOrderBy( orderBy );
+ }
}
}
Modified: annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
===================================================================
--- annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -14,10 +14,6 @@
import org.hibernate.JDBCException;
import org.hibernate.Session;
import org.hibernate.Transaction;
-import org.hibernate.dialect.MySQLDialect;
-import org.hibernate.dialect.Oracle8iDialect;
-import org.hibernate.dialect.PostgreSQLDialect;
-import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.test.annotations.TestCase;
/**
@@ -258,38 +254,9 @@
s.close();
}
- /**
- * ANN-625
- *
- * @throws Exception in case the test fails.
- *
- * This test only works against databases which allow a mixed usage of
- * table names and table aliases. The generated SQL for this test is:
- *
- * select
- * contractor0_.EMPLOYER_ID as EMPLOYER1_1_,
- * contractor0_.CONTRACTOR_ID as CONTRACTOR2_1_,
- * contractor1_.id as id2_0_,
- * contractor1_.fld_name as fld3_2_0_,
- * contractor1_.hourlyRate as hourlyRate2_0_
- * from
- * EMPLOYER_CONTRACTOR contractor0_
- * left outer join
- * Employee contractor1_
- * on contractor0_.CONTRACTOR_ID=contractor1_.id
- * where
- * contractor0_.EMPLOYER_ID=?
- * order by
- * Employee.fld_name desc
- *
- *
- */
-// HHH-3577 JBPAPP-1123
+
+ // HHH-4394
public void testOrderByContractor() throws Exception {
- if(getDialect() instanceof MySQLDialect || getDialect() instanceof PostgreSQLDialect || getDialect() instanceof SQLServerDialect|| getDialect() instanceof Oracle8iDialect){
- log.warn("skip test testOrderByContractor due to JBPAPP-1123");
- return;
- }
Session s;
Transaction tx;
s = openSession();
Modified: annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java
===================================================================
--- annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ annotations/patches/JBPAPP-6940/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -79,10 +79,16 @@
s.flush();
s.clear();
- //testing @OrderBy with explicit values including Formula
+ // Assert the primary key value relationship amongst the 3 streets...
+ assertTrue( rochechoir.getId() < chmpsElysees.getId() );
+ assertTrue( chmpsElysees.getId() < grandeArmee.getId() );
paris = (City) s.get( City.class, paris.getId() );
+
+ // City.streets is defined to be ordered by name primarily...
assertEquals( 3, paris.getStreets().size() );
assertEquals( chmpsElysees.getStreetName(), paris.getStreets().get( 0 ).getStreetName() );
+ assertEquals( grandeArmee.getStreetName(), paris.getStreets().get( 1 ).getStreetName() );
+ // City.mainStreets is defined to be ordered by street id
List<Street> mainStreets = paris.getMainStreets();
assertEquals( 2, mainStreets.size() );
Integer previousId = new Integer( -1 );
@@ -381,7 +387,8 @@
tx.commit();
s.close();
}
- //known issue JBPAPP-1123 HHH-3577
+
+ // HHH-4394
public void testOrderByOnSuperclassProperty() {
if(getDialect() instanceof MySQLDialect || getDialect() instanceof PostgreSQLDialect || getDialect() instanceof SQLServerDialect|| getDialect() instanceof Oracle8iDialect){
log.warn("skip test testOrderByContractor due to JBPAPP-1123");
Property changes on: core/patches/JBPAPP-6940
___________________________________________________________________
Added: svn:ignore
+ .settings
build
.classpath
.project
Modified: core/patches/JBPAPP-6940/build.xml
===================================================================
--- core/patches/JBPAPP-6940/build.xml 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/build.xml 2012-08-30 16:55:39 UTC (rev 21065)
@@ -48,6 +48,7 @@
<property name="dir.out.test-classes" value="${dir.build}/testclasses"/>
<property name="dir.out.generated-source" value="${dir.build}/gensrc"/>
<property name="dir.out.antlr-package" value="${dir.out.generated-source}/org/hibernate/hql/antlr"/>
+ <property name="dir.out.antlr-package.order-by" value="${dir.out.generated-source}/org/hibernate/sql/ordering/antlr"/>
<property name="dir.out.junit" value="${dir.build}/testout"/>
<property name="dir.out.junit-reports" value="${dir.build}/test-reports"/>
<property name="dir.out.perf-test" value="${dir.build}/testout-perf"/>
@@ -170,7 +171,8 @@
<target name="antlr" depends="init.antlr" unless="antlr.isUpToDate" description="Generate ANTLR parsers.">
<mkdir dir="${dir.out.antlr-package}"/>
- <antlr target="${dir.grammar}/hql.g" outputdirectory="${dir.out.antlr-package}">
+ <mkdir dir="${dir.out.antlr-package.order-by}"/>
+ <antlr target="${dir.grammar}/hql.g" outputdirectory="${dir.out.antlr-package}">
<classpath refid="path.lib"/>
</antlr>
<antlr target="${dir.grammar}/hql-sql.g" outputdirectory="${dir.out.antlr-package}">
@@ -179,6 +181,12 @@
<antlr target="${dir.grammar}/sql-gen.g" outputdirectory="${dir.out.antlr-package}">
<classpath refid="path.lib"/>
</antlr>
+ <antlr target="${dir.grammar}/order-by.g" outputdirectory="${dir.out.antlr-package.order-by}">
+ <classpath refid="path.lib"/>
+ </antlr>
+ <antlr target="${dir.grammar}/order-by-render.g" outputdirectory="${dir.out.antlr-package.order-by}">
+ <classpath refid="path.lib"/>
+ </antlr>
<touch file="${dir.out.antlr-package}/.antlr_run"/>
</target>
Added: core/patches/JBPAPP-6940/grammar/order-by-render.g
===================================================================
--- core/patches/JBPAPP-6940/grammar/order-by-render.g (rev 0)
+++ core/patches/JBPAPP-6940/grammar/order-by-render.g 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,92 @@
+header
+{
+/*
+ * 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.sql.ordering.antlr;
+}
+/**
+ * Antlr grammar for rendering <tt>ORDER_BY</tt> trees as described by the {@link OrderByFragmentParser}
+
+ * @author Steve Ebersole
+ */
+class GeneratedOrderByFragmentRenderer extends TreeParser;
+
+options {
+ importVocab=OrderByTemplate;
+ buildAST=false;
+}
+
+{
+ // the buffer to which we write the resulting SQL.
+ private StringBuilder buffer = new StringBuilder();
+
+ protected void out(String text) {
+ buffer.append( text );
+ }
+
+ protected void out(AST ast) {
+ buffer.append( ast.getText() );
+ }
+
+ /*package*/ String getRenderedFragment() {
+ return buffer.toString();
+ }
+}
+
+orderByFragment
+ : #(
+ ORDER_BY sortSpecification ( {out(", ");} sortSpecification)*
+ )
+ ;
+
+sortSpecification
+ : #(
+ SORT_SPEC sortKeySpecification (collationSpecification)? (orderingSpecification)?
+ )
+ ;
+
+sortKeySpecification
+ : #(SORT_KEY sortKey)
+ ;
+
+sortKey
+ : i:IDENT {
+ out( #i );
+ }
+ ;
+
+collationSpecification
+ : c:COLLATE {
+ out( " collate " );
+ out( c );
+ }
+ ;
+
+orderingSpecification
+ : o:ORDER_SPEC {
+ out( " " );
+ out( #o );
+ }
+ ;
\ No newline at end of file
Added: core/patches/JBPAPP-6940/grammar/order-by.g
===================================================================
--- core/patches/JBPAPP-6940/grammar/order-by.g (rev 0)
+++ core/patches/JBPAPP-6940/grammar/order-by.g 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,440 @@
+header
+{
+/*
+ * 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.sql.ordering.antlr;
+}
+/**
+ * Antlr grammar for dealing with <tt>order-by</tt> mapping fragments.
+
+ * @author Steve Ebersole
+ */
+class GeneratedOrderByFragmentParser extends Parser;
+
+options
+{
+ exportVocab=OrderByTemplate;
+ buildAST=true;
+ k=3;
+}
+
+tokens
+{
+ // synthetic tokens
+ ORDER_BY;
+ SORT_SPEC;
+ ORDER_SPEC;
+ SORT_KEY;
+ EXPR_LIST;
+ DOT;
+ IDENT_LIST;
+ COLUMN_REF;
+
+ COLLATE="collate";
+ ASCENDING="asc";
+ DESCENDING="desc";
+}
+
+
+{
+ /**
+ * Method for logging execution trace information.
+ *
+ * @param msg The trace message.
+ */
+ protected void trace(String msg) {
+ System.out.println( msg );
+ }
+
+ /**
+ * Extract a node's text.
+ *
+ * @param ast The node
+ *
+ * @return The text.
+ */
+ protected final String extractText(AST ast) {
+ // for some reason, within AST creation blocks "[]" I am somtimes unable to refer to the AST.getText() method
+ // using #var (the #var is not interpreted as the rule's output AST).
+ return ast.getText();
+ }
+
+ /**
+ * Process the given node as a quote identifier. These need to be quoted in the dialect-specific way.
+ *
+ * @param ident The quoted-identifier node.
+ *
+ * @return The processed node.
+ *
+ * @see org.hibernate.dialect.Dialect#quote
+ */
+ protected AST quotedIdentifier(AST ident) {
+ return ident;
+ }
+
+ /**
+ * Process the given node as a quote string.
+ *
+ * @param ident The quoted string. This is used from within function param recognition, and represents a
+ * SQL-quoted string.
+ *
+ * @return The processed node.
+ */
+ protected AST quotedString(AST ident) {
+ return ident;
+ }
+
+ /**
+ * A check to see if the text of the given node represents a known function name.
+ *
+ * @param ast The node whose text we want to check.
+ *
+ * @return True if the node's text is a known function name, false otherwise.
+ *
+ * @see org.hibernate.dialect.function.SQLFunctionRegistry
+ */
+ protected boolean isFunctionName(AST ast) {
+ return false;
+ }
+
+ /**
+ * Process the given node as a function.
+ *
+ * @param The node representing the function invocation (including parameters as subtree components).
+ *
+ * @return The processed node.
+ */
+ protected AST resolveFunction(AST ast) {
+ return ast;
+ }
+
+ /**
+ * Process the given node as an IDENT. May represent either a column reference or a property reference.
+ *
+ * @param ident The node whose text represents either a column or property reference.
+ *
+ * @return The processed node.
+ */
+ protected AST resolveIdent(AST ident) {
+ return ident;
+ }
+
+ /**
+ * Allow post processing of each <tt>sort specification</tt>
+ *
+ * @param The grammar-built sort specification subtree.
+ *
+ * @return The processed sort specification subtree.
+ */
+ protected AST postProcessSortSpecification(AST sortSpec) {
+ return sortSpec;
+ }
+
+}
+
+/**
+ * Main recognition rule for this grammar
+ */
+orderByFragment { trace("orderByFragment"); }
+ : sortSpecification ( COMMA! sortSpecification )* {
+ #orderByFragment = #( [ORDER_BY, "order-by"], #orderByFragment );
+ }
+ ;
+
+/**
+ * Recognition rule for what ANSI SQL terms the <tt>sort specification</tt>, which is essentially each thing upon which
+ * the results should be sorted.
+ */
+sortSpecification { trace("sortSpecification"); }
+ : sortKey (collationSpecification)? (orderingSpecification)? {
+ #sortSpecification = #( [SORT_SPEC, "{sort specification}"], #sortSpecification );
+ #sortSpecification = postProcessSortSpecification( #sortSpecification );
+ }
+ ;
+
+/**
+ * Recognition rule for what ANSI SQL terms the <tt>sort key</tt> which is the expression (column, function, etc) upon
+ * which to base the sorting.
+ */
+sortKey! { trace("sortKey"); }
+ : e:expression {
+ #sortKey = #( [SORT_KEY, "sort key"], #e );
+ }
+ ;
+
+/**
+ * Recognition rule what this grammar recognizes as valid <tt>sort key</tt>.
+ */
+expression! { trace("expression"); }
+ : HARD_QUOTE qi:IDENT HARD_QUOTE {
+ #expression = quotedIdentifier( #qi );
+ }
+ | ( IDENT (DOT IDENT)* OPEN_PAREN ) => f:functionCall {
+ #expression = #f;
+ }
+ | p:simplePropertyPath {
+ #expression = resolveIdent( #p );
+ }
+ | i:IDENT {
+ if ( isFunctionName( #i ) ) {
+ #expression = resolveFunction( #i );
+ }
+ else {
+ #expression = resolveIdent( #i );
+ }
+ }
+ ;
+
+/**
+ * Intended for use as a syntactic predicate to determine whether an IDENT represents a known SQL function name.
+ */
+functionCallCheck! { trace("functionCallCheck"); }
+ : IDENT (DOT IDENT)* OPEN_PAREN { true }?
+ ;
+
+/**
+ * Recognition rule for a function call
+ */
+functionCall! { trace("functionCall"); }
+ : fn:functionName OPEN_PAREN pl:functionParameterList CLOSE_PAREN {
+ #functionCall = #( [IDENT, extractText( #fn )], #pl );
+ #functionCall = resolveFunction( #functionCall );
+ }
+ ;
+
+/**
+ * A function-name is an IDENT followed by zero or more (DOT IDENT) sequences
+ */
+functionName {
+ trace("functionName");
+ StringBuilder buffer = new StringBuilder();
+ }
+ : i:IDENT { buffer.append( i.getText() ); }
+ ( DOT i2:IDENT { buffer.append( '.').append( i2.getText() ); } )* {
+ #functionName = #( [IDENT,buffer.toString()] );
+ }
+ ;
+
+/**
+ * Recognition rule used to "wrap" all function parameters into an EXPR_LIST node
+ */
+functionParameterList { trace("functionParameterList"); }
+ : functionParameter ( COMMA! functionParameter )* {
+ #functionParameterList = #( [EXPR_LIST, "{param list}"], #functionParameterList );
+ }
+ ;
+
+/**
+ * Recognized function parameters.
+ */
+functionParameter { trace("functionParameter"); }
+ : expression
+ | NUM_DOUBLE
+ | NUM_FLOAT
+ | NUM_INT
+ | NUM_LONG
+ | QUOTED_STRING {
+ #functionParameter = quotedString( #functionParameter );
+ }
+ ;
+
+/**
+ * Recognition rule for what ANSI SQL terms the <tt>collation specification</tt> used to allow specifying that sorting for
+ * the given {@link #sortSpecification} be treated within a specific character-set.
+ */
+collationSpecification! { trace("collationSpecification"); }
+ : c:COLLATE cn:collationName {
+ #collationSpecification = #( [COLLATE, extractText( #cn )] );
+ }
+ ;
+
+/**
+ * The collation name wrt {@link #collationSpecification}. Namely, the character-set.
+ */
+collationName { trace("collationSpecification"); }
+ : IDENT
+ ;
+
+/**
+ * Recognition rule for what ANSI SQL terms the <tt>ordering specification</tt>; <tt>ASCENDING</tt> or
+ * <tt>DESCENDING</tt>.
+ */
+orderingSpecification! { trace("orderingSpecification"); }
+ : ( "asc" | "ascending" ) {
+ #orderingSpecification = #( [ORDER_SPEC, "asc"] );
+ }
+ | ( "desc" | "descending") {
+ #orderingSpecification = #( [ORDER_SPEC, "desc"] );
+ }
+ ;
+
+/**
+ * A simple-property-path is an IDENT followed by one or more (DOT IDENT) sequences
+ */
+simplePropertyPath {
+ trace("simplePropertyPath");
+ StringBuilder buffer = new StringBuilder();
+ }
+ : i:IDENT { buffer.append( i.getText() ); }
+ ( DOT i2:IDENT { buffer.append( '.').append( i2.getText() ); } )+ {
+ #simplePropertyPath = #( [IDENT,buffer.toString()] );
+ }
+ ;
+
+
+// **** LEXER ******************************************************************
+
+/**
+ * Lexer for the <tt>order-by</tt> fragment parser
+
+ * @author Steve Ebersole
+ * @author Joshua Davis
+ */
+class GeneratedOrderByLexer extends Lexer;
+
+options {
+ exportVocab=OrderByTemplate;
+ testLiterals = false;
+ k=2;
+ charVocabulary='\u0000'..'\uFFFE'; // Allow any char but \uFFFF (16 bit -1, ANTLR's EOF character)
+ caseSensitive = false;
+ caseSensitiveLiterals = false;
+}
+
+// -- Keywords --
+
+OPEN_PAREN: '(';
+CLOSE_PAREN: ')';
+
+COMMA: ',';
+
+HARD_QUOTE: '`';
+
+IDENT options { testLiterals=true; }
+ : ID_START_LETTER ( ID_LETTER )*
+ ;
+
+protected
+ID_START_LETTER
+ : '_'
+ | '$'
+ | 'a'..'z'
+ | '\u0080'..'\ufffe' // HHH-558 : Allow unicode chars in identifiers
+ ;
+
+protected
+ID_LETTER
+ : ID_START_LETTER
+ | '0'..'9'
+ ;
+
+QUOTED_STRING
+ : '\'' ( (ESCqs)=> ESCqs | ~'\'' )* '\''
+ ;
+
+protected
+ESCqs
+ :
+ '\'' '\''
+ ;
+
+//--- From the Java example grammar ---
+// a numeric literal
+NUM_INT
+ {boolean isDecimal=false; Token t=null;}
+ : '.' {_ttype = DOT;}
+ ( ('0'..'9')+ (EXPONENT)? (f1:FLOAT_SUFFIX {t=f1;})?
+ {
+ if (t != null && t.getText().toUpperCase().indexOf('F')>=0)
+ {
+ _ttype = NUM_FLOAT;
+ }
+ else
+ {
+ _ttype = NUM_DOUBLE; // assume double
+ }
+ }
+ )?
+ | ( '0' {isDecimal = true;} // special case for just '0'
+ ( ('x')
+ ( // hex
+ // the 'e'|'E' and float suffix stuff look
+ // like hex digits, hence the (...)+ doesn't
+ // know when to stop: ambig. ANTLR resolves
+ // it correctly by matching immediately. It
+ // is therefore ok to hush warning.
+ options { warnWhenFollowAmbig=false; }
+ : HEX_DIGIT
+ )+
+ | ('0'..'7')+ // octal
+ )?
+ | ('1'..'9') ('0'..'9')* {isDecimal=true;} // non-zero decimal
+ )
+ ( ('l') { _ttype = NUM_LONG; }
+
+ // only check to see if it's a float if looks like decimal so far
+ | {isDecimal}?
+ ( '.' ('0'..'9')* (EXPONENT)? (f2:FLOAT_SUFFIX {t=f2;})?
+ | EXPONENT (f3:FLOAT_SUFFIX {t=f3;})?
+ | f4:FLOAT_SUFFIX {t=f4;}
+ )
+ {
+ if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0)
+ {
+ _ttype = NUM_FLOAT;
+ }
+ else
+ {
+ _ttype = NUM_DOUBLE; // assume double
+ }
+ }
+ )?
+ ;
+
+// hexadecimal digit (again, note it's protected!)
+protected
+HEX_DIGIT
+ : ('0'..'9'|'a'..'f')
+ ;
+
+// a couple protected methods to assist in matching floating point numbers
+protected
+EXPONENT
+ : ('e') ('+'|'-')? ('0'..'9')+
+ ;
+
+protected
+FLOAT_SUFFIX
+ : 'f'|'d'
+ ;
+
+WS : ( ' '
+ | '\t'
+ | '\r' '\n' { newline(); }
+ | '\n' { newline(); }
+ | '\r' { newline(); }
+ )
+ {$setType(Token.SKIP);} //ignore this token
+ ;
Modified: core/patches/JBPAPP-6940/src/org/hibernate/hql/ast/util/ASTPrinter.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/hql/ast/util/ASTPrinter.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/hql/ast/util/ASTPrinter.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -149,7 +149,7 @@
* @return String - The token type name from the token type constant class,
* or just the integer as a string if none exists.
*/
- private String getTokenTypeName(int type) {
+ public String getTokenTypeName(int type) {
// If the class with the constants in it was not supplied, just
// use the integer token type as the token type name.
if ( tokenTypeConstants == null ) {
Modified: core/patches/JBPAPP-6940/src/org/hibernate/persister/collection/AbstractCollectionPersister.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/persister/collection/AbstractCollectionPersister.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/persister/collection/AbstractCollectionPersister.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -18,8 +18,6 @@
import org.hibernate.MappingException;
import org.hibernate.QueryException;
import org.hibernate.TransientObjectException;
-import org.hibernate.jdbc.Expectation;
-import org.hibernate.jdbc.Expectations;
import org.hibernate.cache.CacheConcurrencyStrategy;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.entry.CacheEntryStructure;
@@ -30,14 +28,16 @@
import org.hibernate.collection.PersistentCollection;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.EntityKey;
+import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
import org.hibernate.engine.PersistenceContext;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.engine.SubselectFetch;
-import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
import org.hibernate.exception.JDBCExceptionHelper;
import org.hibernate.exception.SQLExceptionConverter;
import org.hibernate.id.IdentifierGenerator;
+import org.hibernate.jdbc.Expectation;
+import org.hibernate.jdbc.Expectations;
import org.hibernate.loader.collection.CollectionInitializer;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
@@ -51,11 +51,18 @@
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Loadable;
import org.hibernate.persister.entity.PropertyMapping;
+import org.hibernate.persister.entity.Queryable;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.sql.Alias;
import org.hibernate.sql.SelectFragment;
import org.hibernate.sql.SimpleSelect;
import org.hibernate.sql.Template;
+import org.hibernate.sql.ordering.antlr.ColumnMapper;
+import org.hibernate.sql.ordering.antlr.ColumnReference;
+import org.hibernate.sql.ordering.antlr.FormulaReference;
+import org.hibernate.sql.ordering.antlr.OrderByAliasResolver;
+import org.hibernate.sql.ordering.antlr.OrderByTranslation;
+import org.hibernate.sql.ordering.antlr.SqlValueReference;
import org.hibernate.type.AbstractComponentType;
import org.hibernate.type.CollectionType;
import org.hibernate.type.EntityType;
@@ -89,14 +96,17 @@
private final String sqlDetectRowByIndexString;
private final String sqlDetectRowByElementString;
- private final String sqlOrderByString;
protected final String sqlWhereString;
- private final String sqlOrderByStringTemplate;
private final String sqlWhereStringTemplate;
- private final boolean hasOrder;
protected final boolean hasWhere;
private final int baseIndex;
+ private final boolean hasOrder;
+ private final OrderByTranslation orderByTranslation;
+
+ private final boolean hasManyToManyOrder;
+ private final OrderByTranslation manyToManyOrderByTranslation;
+
private final String nodeName;
private final String elementNodeName;
private final String indexNodeName;
@@ -173,9 +183,6 @@
private final String manyToManyWhereString;
private final String manyToManyWhereTemplate;
- private final String manyToManyOrderByString;
- private final String manyToManyOrderByTemplate;
-
// custom sql
private final boolean insertCallable;
private final boolean updateCallable;
@@ -243,12 +250,7 @@
for ( int i = 1; i < spacesSize; i++ ) {
spaces[i] = (String) iter.next();
}
-
- sqlOrderByString = collection.getOrderBy();
- hasOrder = sqlOrderByString != null;
- sqlOrderByStringTemplate = hasOrder ?
- Template.renderOrderByStringTemplate(sqlOrderByString, dialect, factory.getSqlFunctionRegistry()) :
- null;
+
sqlWhereString = StringHelper.isNotEmpty( collection.getWhere() ) ? "( " + collection.getWhere() + ") " : null;
hasWhere = sqlWhereString != null;
sqlWhereStringTemplate = hasWhere ?
@@ -517,6 +519,20 @@
);
}
}
+
+ hasOrder = collection.getOrderBy() != null;
+ if ( hasOrder ) {
+ orderByTranslation = Template.translateOrderBy(
+ collection.getOrderBy(),
+ new ColumnMapperImpl(),
+ factory,
+ dialect,
+ factory.getSqlFunctionRegistry()
+ );
+ }
+ else {
+ orderByTranslation = null;
+ }
// Handle any filters applied to this collection
filterHelper = new FilterHelper( collection.getFilterMap(), dialect, factory.getSqlFunctionRegistry() );
@@ -529,14 +545,76 @@
manyToManyWhereTemplate = manyToManyWhereString == null ?
null :
Template.renderWhereStringTemplate( manyToManyWhereString, factory.getDialect(), factory.getSqlFunctionRegistry() );
- manyToManyOrderByString = collection.getManyToManyOrdering();
- manyToManyOrderByTemplate = manyToManyOrderByString == null
- ? null
- : Template.renderOrderByStringTemplate( manyToManyOrderByString, factory.getDialect(), factory.getSqlFunctionRegistry() );
+
+ hasManyToManyOrder = collection.getManyToManyOrdering() != null;
+ if ( hasManyToManyOrder ) {
+ manyToManyOrderByTranslation = Template.translateOrderBy(
+ collection.getManyToManyOrdering(),
+ new ColumnMapperImpl(),
+ factory,
+ dialect,
+ factory.getSqlFunctionRegistry()
+ );
+ }
+ else {
+ manyToManyOrderByTranslation = null;
+ }
initCollectionPropertyMap();
}
+
+ private class ColumnMapperImpl implements ColumnMapper {
+ public SqlValueReference[] map(String reference) {
+ final String[] columnNames;
+ final String[] formulaTemplates;
+ // handle the special "$element$" property name...
+ if ( "$element$".equals( reference ) ) {
+ columnNames = elementColumnNames;
+ formulaTemplates = elementFormulaTemplates;
+ }
+ else {
+ columnNames = elementPropertyMapping.toColumns( reference );
+ formulaTemplates = formulaTemplates( reference, columnNames.length );
+ }
+
+ final SqlValueReference[] result = new SqlValueReference[ columnNames.length ];
+ int i = 0;
+ for ( final String columnName : columnNames ) {
+ if ( columnName == null ) {
+ // if the column name is null, it indicates that this index in the property value mapping is
+ // actually represented by a formula.
+ final int propertyIndex = elementPersister.getEntityMetamodel().getPropertyIndex( reference );
+ final String formulaTemplate = formulaTemplates[i];
+ result[i] = new FormulaReference() {
+ public String getFormulaFragment() {
+ return formulaTemplate;
+ }
+ };
+ }
+ else {
+ result[i] = new ColumnReference() {
+ public String getColumnName() {
+ return columnName;
+ }
+ };
+ }
+ i++;
+ }
+ return result;
+ }
+ }
+
+ private String[] formulaTemplates(String reference, int expectedSize) {
+ try {
+ final int propertyIndex = elementPersister.getEntityMetamodel().getPropertyIndex( reference );
+ return ( (Queryable) elementPersister ).getSubclassPropertyFormulaTemplateClosure()[propertyIndex];
+ }
+ catch (Exception e) {
+ return new String[expectedSize];
+ }
+ }
+
public void postInstantiate() throws MappingException {
initializer = queryLoaderName == null ?
createCollectionInitializer( CollectionHelper.EMPTY_MAP ) :
@@ -635,18 +713,17 @@
}
public String getSQLOrderByString(String alias) {
- return hasOrdering() ?
- StringHelper.replace( sqlOrderByStringTemplate, Template.TEMPLATE, alias ) : "";
+ return hasOrdering()
+ ? orderByTranslation.injectAliases( new StandardOrderByAliasResolver( alias ) )
+ : "";
}
public String getManyToManyOrderByString(String alias) {
- if ( isManyToMany() && manyToManyOrderByString != null ) {
- return StringHelper.replace( manyToManyOrderByTemplate, Template.TEMPLATE, alias );
- }
- else {
- return "";
- }
+ return hasManyToManyOrdering()
+ ? manyToManyOrderByTranslation.injectAliases( new StandardOrderByAliasResolver( alias ) )
+ : "";
}
+
public FetchMode getFetchMode() {
return fetchMode;
}
@@ -656,7 +733,7 @@
}
public boolean hasManyToManyOrdering() {
- return isManyToMany() && manyToManyOrderByTemplate != null;
+ return isManyToMany() && hasManyToManyOrder;
}
public boolean hasWhere() {
@@ -1792,4 +1869,22 @@
public CollectionInitializer getInitializer() {
return initializer;
}
+
+ private class StandardOrderByAliasResolver implements OrderByAliasResolver {
+ private final String rootAlias;
+
+ private StandardOrderByAliasResolver(String rootAlias) {
+ this.rootAlias = rootAlias;
+ }
+
+ public String resolveTableAlias(String columnReference) {
+ if ( elementPersister == null ) {
+ // we have collection of non-entity elements...
+ return rootAlias;
+ }
+ else {
+ return ( (Loadable) elementPersister ).getTableAliasForColumn( columnReference, rootAlias );
+ }
+ }
+ }
}
Modified: core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -1488,7 +1488,7 @@
return propertyDefinedOnSubclass[i];
}
- protected String[][] getSubclassPropertyFormulaTemplateClosure() {
+ public String[][] getSubclassPropertyFormulaTemplateClosure() {
return subclassPropertyFormulaTemplateClosure;
}
@@ -3844,6 +3844,13 @@
throws HibernateException {
getTuplizer( entityMode ).setPropertyValue( object, propertyName, value );
}
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ public String getTableAliasForColumn(String columnName, String rootAlias) {
+ return generateTableAlias( rootAlias, determineTableNumberForColumn( columnName ) );
+ }
+ public int determineTableNumberForColumn(String columnName) {
+ return 0;
+ }
+
}
Modified: core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -584,4 +584,24 @@
}
return super.getSubclassPropertyDeclarer( propertyPath );
}
+
+ @Override
+ public int determineTableNumberForColumn(String columnName) {
+ final String[] subclassColumnNameClosure = getSubclassColumnClosure();
+ for ( int i = 0, max = subclassColumnNameClosure.length; i < max; i++ ) {
+ final boolean quoted = subclassColumnNameClosure[i].startsWith( "\"" )
+ && subclassColumnNameClosure[i].endsWith( "\"" );
+ if ( quoted ) {
+ if ( subclassColumnNameClosure[i].equals( columnName ) ) {
+ return getSubclassColumnTableNumberClosure()[i];
+ }
+ }
+ else {
+ if ( subclassColumnNameClosure[i].equalsIgnoreCase( columnName ) ) {
+ return getSubclassColumnTableNumberClosure()[i];
+ }
+ }
+ }
+ throw new HibernateException( "Could not locate table which owns column [" + columnName + "] referenced in order-by mapping" );
+ }
}
Modified: core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Loadable.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Loadable.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Loadable.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -85,4 +85,18 @@
public boolean isAbstract();
+ /**
+ * Given a column name and the root table alias in use for the entity hierarchy, determine the proper table alias
+ * for the table in that hierarchy that contains said column.
+ * <p/>
+ * NOTE : Generally speaking the column is not validated to exist. Most implementations simply return the
+ * root alias; the exception is {@link JoinedSubclassEntityPersister}
+ *
+ * @param columnName The column name
+ * @param rootAlias The hierarchy root alias
+ *
+ * @return The proper table alias for qualifying the given column.
+ */
+ public String getTableAliasForColumn(String columnName, String rootAlias);
+
}
Modified: core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Queryable.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Queryable.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/persister/entity/Queryable.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -139,6 +139,8 @@
*/
public String generateFilterConditionAlias(String rootAlias);
+ String[][] getSubclassPropertyFormulaTemplateClosure();
+
public static class Declarer {
public static final Declarer CLASS = new Declarer( "class" );
public static final Declarer SUBCLASS = new Declarer( "subclass" );
Modified: core/patches/JBPAPP-6940/src/org/hibernate/sql/Template.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/Template.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/Template.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -6,6 +6,13 @@
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunctionRegistry;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.sql.ordering.antlr.ColumnMapper;
+import org.hibernate.sql.ordering.antlr.OrderByAliasResolver;
+import org.hibernate.sql.ordering.antlr.OrderByFragmentTranslator;
+import org.hibernate.sql.ordering.antlr.OrderByTranslation;
+import org.hibernate.sql.ordering.antlr.SqlValueReference;
+import org.hibernate.sql.ordering.antlr.TranslationContext;
import org.hibernate.util.StringHelper;
/**
@@ -208,93 +215,105 @@
return result.toString();
}
+
+
+ public static class NoOpColumnMapper implements ColumnMapper {
+ public static final NoOpColumnMapper INSTANCE = new NoOpColumnMapper();
+ public SqlValueReference[] map(String reference) {
+ // return new String[] { reference };
+ return null;
+ }
+ }
+
/**
- * Takes order by clause provided in the mapping attribute and interpolates the alias.
- * Handles asc, desc, SQL functions, quoted identifiers.
+ * Performs order-by template rendering without {@link ColumnMapper column mapping}. An <tt>ORDER BY</tt> template
+ * has all column references "qualified" with a placeholder identified by {@link Template#TEMPLATE}
+ *
+ * @param orderByFragment The order-by fragment to render.
+ * @param dialect The SQL dialect being used.
+ * @param functionRegistry The SQL function registry
+ *
+ * @return The rendered <tt>ORDER BY</tt> template.
+ *
+ * @deprecated Use {@link #translateOrderBy} instead
*/
- public static String renderOrderByStringTemplate(String sqlOrderByString, Dialect dialect, SQLFunctionRegistry functionRegistry) {
- //TODO: make this a bit nicer
- String symbols = new StringBuffer()
- .append("=><!+-*/()',|&`")
- .append(StringHelper.WHITESPACE)
- .append( dialect.openQuote() )
- .append( dialect.closeQuote() )
- .toString();
- StringTokenizer tokens = new StringTokenizer(sqlOrderByString, symbols, true);
-
- StringBuffer result = new StringBuffer();
- boolean quoted = false;
- boolean quotedIdentifier = false;
-
- boolean hasMore = tokens.hasMoreTokens();
- String nextToken = hasMore ? tokens.nextToken() : null;
- while (hasMore) {
- String token = nextToken;
- String lcToken = token.toLowerCase();
- hasMore = tokens.hasMoreTokens();
- nextToken = hasMore ? tokens.nextToken() : null;
-
- boolean isQuoteCharacter = false;
-
- if ( !quotedIdentifier && "'".equals(token) ) {
- quoted = !quoted;
- isQuoteCharacter = true;
+ @Deprecated
+ public static String renderOrderByStringTemplate(
+ String orderByFragment,
+ Dialect dialect,
+ SQLFunctionRegistry functionRegistry) {
+ return renderOrderByStringTemplate(
+ orderByFragment,
+ NoOpColumnMapper.INSTANCE,
+ null,
+ dialect,
+ functionRegistry
+ );
+ }
+
+ public static String renderOrderByStringTemplate(
+ String orderByFragment,
+ final ColumnMapper columnMapper,
+ final SessionFactoryImplementor sessionFactory,
+ final Dialect dialect,
+ final SQLFunctionRegistry functionRegistry) {
+ return translateOrderBy(
+ orderByFragment,
+ columnMapper,
+ sessionFactory,
+ dialect,
+ functionRegistry
+ ).injectAliases( LEGACY_ORDER_BY_ALIAS_RESOLVER );
+ }
+
+ public static OrderByAliasResolver LEGACY_ORDER_BY_ALIAS_RESOLVER = new OrderByAliasResolver() {
+ public String resolveTableAlias(String columnReference) {
+ return TEMPLATE;
+ }
+ };
+
+ /**
+ * Performs order-by template rendering allowing {@link ColumnMapper column mapping}. An <tt>ORDER BY</tt> template
+ * has all column references "qualified" with a placeholder identified by {@link Template#TEMPLATE} which can later
+ * be used to easily inject the SQL alias.
+ *
+ * @param orderByFragment The order-by fragment to render.
+ * @param columnMapper The column mapping strategy to use.
+ * @param sessionFactory The session factory.
+ * @param dialect The SQL dialect being used.
+ * @param functionRegistry The SQL function registry
+ *
+ * @return The rendered <tt>ORDER BY</tt> template.
+ */
+ public static OrderByTranslation translateOrderBy(
+ String orderByFragment,
+ final ColumnMapper columnMapper,
+ final SessionFactoryImplementor sessionFactory,
+ final Dialect dialect,
+ final SQLFunctionRegistry functionRegistry) {
+ TranslationContext context = new TranslationContext() {
+ public SessionFactoryImplementor getSessionFactory() {
+ return sessionFactory;
}
-
- if ( !quoted ) {
-
- boolean isOpenQuote;
- if ( "`".equals(token) ) {
- isOpenQuote = !quotedIdentifier;
- token = lcToken = isOpenQuote ?
- new Character( dialect.openQuote() ).toString() :
- new Character( dialect.closeQuote() ).toString();
- quotedIdentifier = isOpenQuote;
- isQuoteCharacter = true;
- }
- else if ( !quotedIdentifier && ( dialect.openQuote()==token.charAt(0) ) ) {
- isOpenQuote = true;
- quotedIdentifier = true;
- isQuoteCharacter = true;
- }
- else if ( quotedIdentifier && ( dialect.closeQuote()==token.charAt(0) ) ) {
- quotedIdentifier = false;
- isQuoteCharacter = true;
- isOpenQuote = false;
- }
- else {
- isOpenQuote = false;
- }
-
- if (isOpenQuote) {
- result.append(TEMPLATE).append('.');
- }
-
+
+ public Dialect getDialect() {
+ return dialect;
}
-
- boolean quotedOrWhitespace = quoted ||
- quotedIdentifier ||
- isQuoteCharacter ||
- Character.isWhitespace( token.charAt(0) );
-
- if (quotedOrWhitespace) {
- result.append(token);
+
+ public SQLFunctionRegistry getSqlFunctionRegistry() {
+ return functionRegistry;
}
- else if (
- isIdentifier(token, dialect) &&
- !isFunctionOrKeyword(lcToken, nextToken, dialect, functionRegistry)
- ) {
- result.append(TEMPLATE)
- .append('.')
- .append( dialect.quote(token) );
+
+ public ColumnMapper getColumnMapper() {
+ return columnMapper;
}
- else {
- result.append(token);
- }
- }
- return result.toString();
+ };
+
+ return OrderByFragmentTranslator.translate( context, orderByFragment );
}
+
+
private static boolean isNamedParameter(String token) {
return token.startsWith(":");
}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/CollationSpecification.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/CollationSpecification.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/CollationSpecification.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,33 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Models a collation specification (<tt>COLLATE</tt> using a specific character-set) within a
+ * {@link SortSpecification}.
+ *
+ * @author Steve Ebersole
+ */
+public class CollationSpecification extends NodeSupport {
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnMapper.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnMapper.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnMapper.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,46 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import org.hibernate.HibernateException;
+
+/**
+ * Contract for mapping a (an assumed) property reference to its columns.
+ *
+ * @author Steve Ebersole
+ */
+public interface ColumnMapper {
+ /**
+ * Resolve the property reference to its underlying columns.
+ *
+ * @param reference The property reference name.
+ *
+ * @return References to the columns/formulas that define the value mapping for the given property, or null
+ * if the property reference is unknown.
+ *
+ * @throws HibernateException Generally indicates that the property reference is unknown; interpretation
+ * should be the same as a null return.
+ */
+ public SqlValueReference[] map(String reference) throws HibernateException;
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnReference.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnReference.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/ColumnReference.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,38 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Reference to a column name.
+ *
+ * @author Steve Ebersole
+ */
+public interface ColumnReference extends SqlValueReference {
+ /**
+ * Retrieve the column name.
+ *
+ * @return THe column name
+ */
+ public String getColumnName();
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Factory.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Factory.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Factory.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,51 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import antlr.ASTFactory;
+
+/**
+ * Acts as a {@link ASTFactory} for injecting our specific AST node classes into the Antlr generated trees.
+ *
+ * @author Steve Ebersole
+ */
+public class Factory extends ASTFactory implements OrderByTemplateTokenTypes {
+ @Override
+ public Class getASTNodeType(int i) {
+ switch ( i ) {
+ case ORDER_BY:
+ return OrderByFragment.class;
+ case SORT_SPEC:
+ return SortSpecification.class;
+ case ORDER_SPEC:
+ return OrderingSpecification.class;
+ case COLLATE:
+ return CollationSpecification.class;
+ case SORT_KEY:
+ return SortKey.class;
+ default:
+ return NodeSupport.class;
+ }
+ }
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/FormulaReference.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/FormulaReference.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/FormulaReference.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,40 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Reference to a formula fragment.
+ *
+ * @author Steve Ebersole
+ */
+public interface FormulaReference extends SqlValueReference {
+ /**
+ * Retrieve the formula fragment. It is important to note that this is what the persister calls the
+ * "formula template", which has the $PlaceHolder$ (see {@link org.hibernate.sql.Template#TEMPLATE})
+ * markers injected.
+ *
+ * @return The formula fragment template.
+ */
+ public String getFormulaFragment();
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Node.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Node.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/Node.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,52 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * General contract for AST nodes.
+ *
+ * @author Steve Ebersole
+ */
+public interface Node {
+ /**
+ * Get the intrinsic text of this node.
+ *
+ * @return The node's text.
+ */
+ public String getText();
+
+ /**
+ * Get a string representation of this node usable for debug logging or similar.
+ *
+ * @return The node's debugging text.
+ */
+ public String getDebugText();
+
+ /**
+ * Build the node's representation for use in the resulting rendering.
+ *
+ * @return The text for use in the translated output.
+ */
+ public String getRenderableText();
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/NodeSupport.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/NodeSupport.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/NodeSupport.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,41 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import antlr.CommonAST;
+
+/**
+ * Basic implementation of a {@link Node} briding to the Antlr {@link CommonAST} hierarchy.
+ *
+ * @author Steve Ebersole
+ */
+public class NodeSupport extends CommonAST implements Node {
+ public String getDebugText() {
+ return getText();
+ }
+
+ public String getRenderableText() {
+ return getText();
+ }
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByAliasResolver.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByAliasResolver.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByAliasResolver.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,35 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Given a column reference, resolve the table alias to apply to the column to qualify it.
+ */
+public interface OrderByAliasResolver {
+ /**
+ * Given a column reference, resolve the table alias to apply to the column to qualify it.
+ *
+ */
+ public String resolveTableAlias(String columnReference);
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragment.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragment.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragment.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,32 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Represents a parsed <tt>order-by</tt> mapping fragment. This holds the tree of all {@link SortSpecification}s.
+ *
+ * @author Steve Ebersole
+ */
+public class OrderByFragment extends NodeSupport {
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,333 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.hibernate.dialect.function.SQLFunction;
+import org.hibernate.sql.Template;
+import org.hibernate.util.StringHelper;
+import org.jboss.logging.Logger;
+
+import antlr.CommonAST;
+import antlr.TokenStream;
+import antlr.collections.AST;
+
+/**
+ * Extension of the Antlr-generated parser for the purpose of adding our custom parsing behavior
+ * (semantic analysis, etc).
+ *
+ * @author Steve Ebersole
+ */
+public class OrderByFragmentParser extends GeneratedOrderByFragmentParser {
+ private static final Logger LOG = Logger.getLogger(OrderByFragmentParser.class.getName());
+
+ private final TranslationContext context;
+
+ private Set<String> columnReferences = new HashSet<String>();
+
+ public OrderByFragmentParser(TokenStream lexer, TranslationContext context) {
+ super( lexer );
+ super.setASTFactory( new Factory() );
+ this.context = context;
+ }
+
+ public Set<String> getColumnReferences() {
+ return columnReferences;
+ }
+
+ @Override
+ protected AST quotedIdentifier(AST ident) {
+ /*
+ * Semantic action used during recognition of quoted identifiers (quoted column names)
+ */
+ final String columnName = context.getDialect().quote( '`' + ident.getText() + '`' );
+ columnReferences.add( columnName );
+ final String marker = '{' + columnName + '}';
+ return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, marker );
+ }
+
+ @Override
+ protected AST quotedString(AST ident) {
+ /*
+ * Semantic action used during recognition of quoted strings (string literals)
+ */
+ return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, context.getDialect().quote( ident.getText() ) );
+ }
+
+ @Override
+ @SuppressWarnings("SimplifiableIfStatement")
+ protected boolean isFunctionName(AST ast) {
+ /*
+ * Semantic predicate used to determine whether a given AST node represents a function call
+ */
+
+ AST child = ast.getFirstChild();
+ // assume it is a function if it has parameters
+ if ( child != null && "{param list}".equals( child.getText() ) ) {
+ return true;
+ }
+
+ // otherwise, in order for this to be a function logically it has to be a function that does not
+ // have arguments. So try to assert that using the registry of known functions
+ final SQLFunction function = context.getSqlFunctionRegistry().findSQLFunction( ast.getText() );
+ if ( function == null ) {
+ // no registered function, so we cannot know for certain
+ return false;
+ }
+ else {
+ // if function.hasParenthesesIfNoArguments() is true, then assume the node is not a function
+ return ! function.hasParenthesesIfNoArguments();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected AST resolveFunction(AST ast) {
+ /*
+ * Semantic action used during recognition of a *known* function
+ */
+ AST child = ast.getFirstChild();
+ if ( child != null ) {
+ assert "{param list}".equals( child.getText() );
+ child = child.getFirstChild();
+ }
+
+ final String functionName = ast.getText();
+ final SQLFunction function = context.getSqlFunctionRegistry().findSQLFunction( functionName );
+ if ( function == null ) {
+ String text = functionName;
+ if ( child != null ) {
+ text += '(';
+ while ( child != null ) {
+ text += resolveFunctionArgument( child );
+ child = child.getNextSibling();
+ if ( child != null ) {
+ text += ", ";
+ }
+ }
+ text += ')';
+ }
+ return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
+ }
+ else {
+ ArrayList expressions = new ArrayList();
+ while ( child != null ) {
+ expressions.add( resolveFunctionArgument( child ) );
+ child = child.getNextSibling();
+ }
+ final String text = function.render( expressions, context.getSessionFactory() );
+ return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, text );
+ }
+ }
+
+ private String resolveFunctionArgument(AST argumentNode) {
+ final String nodeText = argumentNode.getText();
+ final String adjustedText;
+ if ( nodeText.contains( Template.TEMPLATE ) ) {
+ // we have a SQL order-by fragment
+ adjustedText = adjustTemplateReferences( nodeText );
+ }
+ else if ( nodeText.startsWith( "{" ) && nodeText.endsWith( "}" ) ) {
+ columnReferences.add( nodeText.substring( 1, nodeText.length() - 1 ) );
+ return nodeText;
+ }
+ else {
+ adjustedText = nodeText;
+ // because we did not process the node text, we need to attempt to find any column references
+ // contained in it.
+ // NOTE : uses regex for the time being; we should check the performance of this
+ Pattern pattern = Pattern.compile( "\\{(.*)\\}" );
+ Matcher matcher = pattern.matcher( adjustedText );
+ while ( matcher.find() ) {
+ columnReferences.add( matcher.group( 1 ) );
+ }
+ }
+ return adjustedText;
+ }
+
+ @Override
+ protected AST resolveIdent(AST ident) {
+ /*
+ * Semantic action used during recognition of an identifier. This identifier might be a column name, it might
+ * be a property name.
+ */
+ String text = ident.getText();
+ SqlValueReference[] sqlValueReferences;
+ try {
+ sqlValueReferences = context.getColumnMapper().map( text );
+ }
+ catch( Throwable t ) {
+ sqlValueReferences = null;
+ }
+
+ if ( sqlValueReferences == null || sqlValueReferences.length == 0 ) {
+ return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, makeColumnReference( text ) );
+ }
+ else if ( sqlValueReferences.length == 1 ) {
+ return processSqlValueReference( sqlValueReferences[0] );
+ }
+ else {
+ final AST root = getASTFactory().create( OrderByTemplateTokenTypes.IDENT_LIST, "{ident list}" );
+ for ( SqlValueReference sqlValueReference : sqlValueReferences ) {
+ root.addChild( processSqlValueReference( sqlValueReference ) );
+ }
+ return root;
+ }
+ }
+
+ private AST processSqlValueReference(SqlValueReference sqlValueReference) {
+ if ( ColumnReference.class.isInstance( sqlValueReference ) ) {
+ final String columnName = ( (ColumnReference) sqlValueReference ).getColumnName();
+ return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, makeColumnReference( columnName ) );
+ }
+ else {
+ final String formulaFragment = ( (FormulaReference) sqlValueReference ).getFormulaFragment();
+ // formulas have already been "adjusted" for aliases by appending Template.TEMPLATE to places
+ // where we believe column references are. Fixing that is beyond scope of this work. But we need
+ // to re-adjust that to use the order-by expectation of wrapping the column names in curly
+ // braces (i.e., `{column_name}`).
+ final String adjustedText = adjustTemplateReferences( formulaFragment );
+ return getASTFactory().create( OrderByTemplateTokenTypes.IDENT, adjustedText );
+ }
+ }
+
+ private String makeColumnReference(String text) {
+ columnReferences.add( text );
+ return "{" + text + "}";
+ }
+
+ private static final int TEMPLATE_MARKER_LENGTH = Template.TEMPLATE.length();
+
+ private String adjustTemplateReferences(String template) {
+ int templateLength = template.length();
+ int startPos = template.indexOf( Template.TEMPLATE );
+ while ( startPos < templateLength ) {
+ int dotPos = startPos + TEMPLATE_MARKER_LENGTH;
+
+ // from here we need to seek the end of the qualified identifier
+ int pos = dotPos + 1;
+ while ( pos < templateLength && isValidIdentifierCharacter( template.charAt( pos ) ) ) {
+ pos++;
+ }
+
+ // At this point we know all 3 points in the template that are needed for replacement.
+ // Basically we will be replacing the whole match with the bit following the dot, but will wrap
+ // the replacement in curly braces.
+ final String columnReference = template.substring( dotPos + 1, pos );
+ final String replacement = "{" + columnReference + "}";
+ template = template.replace( template.substring( startPos, pos ), replacement );
+ columnReferences.add( columnReference );
+
+ // prep for the next seek
+ startPos = ( pos - TEMPLATE_MARKER_LENGTH ) + 1;
+ templateLength = template.length();
+ }
+
+ return template;
+ }
+
+ private static boolean isValidIdentifierCharacter(char c) {
+ return Character.isLetter( c )
+ || Character.isDigit( c )
+ || '_' == c
+ || '\"' == c;
+ }
+
+ @Override
+ protected AST postProcessSortSpecification(AST sortSpec) {
+ assert SORT_SPEC == sortSpec.getType();
+ SortSpecification sortSpecification = ( SortSpecification ) sortSpec;
+ AST sortKey = sortSpecification.getSortKey();
+ if ( IDENT_LIST == sortKey.getFirstChild().getType() ) {
+ AST identList = sortKey.getFirstChild();
+ AST ident = identList.getFirstChild();
+ AST holder = new CommonAST();
+ do {
+ holder.addChild(
+ createSortSpecification(
+ ident,
+ sortSpecification.getCollation(),
+ sortSpecification.getOrdering()
+ )
+ );
+ ident = ident.getNextSibling();
+ } while ( ident != null );
+ sortSpec = holder.getFirstChild();
+ }
+ return sortSpec;
+ }
+
+ private SortSpecification createSortSpecification(
+ AST ident,
+ CollationSpecification collationSpecification,
+ OrderingSpecification orderingSpecification) {
+ AST sortSpecification = getASTFactory().create( SORT_SPEC, "{{sort specification}}" );
+ AST sortKey = getASTFactory().create( SORT_KEY, "{{sort key}}" );
+ AST newIdent = getASTFactory().create( ident.getType(), ident.getText() );
+ sortKey.setFirstChild( newIdent );
+ sortSpecification.setFirstChild( sortKey );
+ if ( collationSpecification != null ) {
+ sortSpecification.addChild( collationSpecification );
+ }
+ if ( orderingSpecification != null ) {
+ sortSpecification.addChild( orderingSpecification );
+ }
+ return ( SortSpecification ) sortSpecification;
+ }
+
+
+
+ // trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ private int traceDepth = 0;
+
+
+ @Override
+ public void traceIn(String ruleName) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = StringHelper.repeat( '-', (traceDepth++ * 2) ) + "-> ";
+ LOG.trace(prefix + ruleName);
+ }
+
+ @Override
+ public void traceOut(String ruleName) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = "<-" + StringHelper.repeat( '-', (--traceDepth * 2) ) + " ";
+ LOG.trace(prefix + ruleName);
+ }
+
+ @Override
+ protected void trace(String msg) {
+ LOG.trace( msg );
+ }
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentRenderer.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,78 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import org.hibernate.hql.ast.util.ASTPrinter;
+import org.hibernate.util.StringHelper;
+import org.jboss.logging.Logger;
+
+import antlr.collections.AST;
+
+/**
+ * Extension of the Antlr-generated tree walker for rendering the parsed order-by tree back to String form.
+ * {@link #out(antlr.collections.AST)} is the sole semantic action here and it is used to utilize our
+ * split between text (tree debugging text) and "renderable text" (text to use during rendering).
+ *
+ * @author Steve Ebersole
+ */
+public class OrderByFragmentRenderer extends GeneratedOrderByFragmentRenderer {
+
+ private static final Logger LOG = Logger.getLogger( OrderByFragmentRenderer.class.getName() );
+ private static final ASTPrinter printer = new ASTPrinter( GeneratedOrderByFragmentRendererTokenTypes.class );
+
+ @Override
+ protected void out(AST ast) {
+ out( ( ( Node ) ast ).getRenderableText() );
+ }
+
+
+ // handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ private int traceDepth = 0;
+
+ @Override
+ public void traceIn(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = StringHelper.repeat( '-', (traceDepth++ * 2) ) + "-> ";
+ String traceText = ruleName + " (" + buildTraceNodeName(tree) + ")";
+ LOG.trace( prefix + traceText );
+ }
+
+ private String buildTraceNodeName(AST tree) {
+ return tree == null
+ ? "???"
+ : tree.getText() + " [" + printer.getTokenTypeName( tree.getType() ) + "]";
+ }
+
+ @Override
+ public void traceOut(String ruleName, AST tree) {
+ if ( inputState.guessing > 0 ) {
+ return;
+ }
+ String prefix = "<-" + StringHelper.repeat( '-', (--traceDepth * 2) ) + " ";
+ LOG.trace( prefix + ruleName );
+ }
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByFragmentTranslator.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,112 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import java.io.StringReader;
+import java.util.Set;
+
+import org.hibernate.HibernateException;
+import org.hibernate.hql.ast.util.ASTPrinter;
+import org.jboss.logging.Logger;
+
+/**
+ * A translator for order-by mappings, whether specified by hbm.xml files, Hibernate
+ * {@link org.hibernate.annotations.OrderBy} annotation or JPA {@link javax.persistence.OrderBy} annotation.
+ *
+ * @author Steve Ebersole
+ */
+public class OrderByFragmentTranslator {
+ private static final Logger LOG = Logger.getLogger( OrderByFragmentTranslator.class.getName() );
+
+ /**
+ * Perform the translation of the user-supplied fragment, returning the translation.
+ * <p/>
+ * The important distinction to this split between (1) translating and (2) resolving aliases is that
+ * both happen at different times
+ *
+ *
+ * @param context Context giving access to delegates needed during translation.
+ * @param fragment The user-supplied order-by fragment
+ *
+ * @return The translation.
+ */
+ public static OrderByTranslation translate(TranslationContext context, String fragment) {
+ GeneratedOrderByLexer lexer = new GeneratedOrderByLexer( new StringReader( fragment ) );
+
+ // Perform the parsing (and some analysis/resolution). Another important aspect is the collection
+ // of "column references" which are important later to seek out replacement points in the
+ // translated fragment.
+ OrderByFragmentParser parser = new OrderByFragmentParser( lexer, context );
+ try {
+ parser.orderByFragment();
+ }
+ catch ( HibernateException e ) {
+ throw e;
+ }
+ catch ( Throwable t ) {
+ throw new HibernateException( "Unable to parse order-by fragment", t );
+ }
+
+ if ( LOG.isTraceEnabled() ) {
+ ASTPrinter printer = new ASTPrinter( OrderByTemplateTokenTypes.class );
+ LOG.trace( printer.showAsString( parser.getAST(), "--- {order-by fragment} ---" ) );
+ }
+
+ // Render the parsed tree to text.
+ OrderByFragmentRenderer renderer = new OrderByFragmentRenderer();
+ try {
+ renderer.orderByFragment( parser.getAST() );
+ }
+ catch ( HibernateException e ) {
+ throw e;
+ }
+ catch ( Throwable t ) {
+ throw new HibernateException( "Unable to render parsed order-by fragment", t );
+ }
+
+ return new StandardOrderByTranslationImpl( renderer.getRenderedFragment(), parser.getColumnReferences() );
+ }
+
+ public static class StandardOrderByTranslationImpl implements OrderByTranslation {
+ private final String sqlTemplate;
+ private final Set<String> columnReferences;
+
+ public StandardOrderByTranslationImpl(String sqlTemplate, Set<String> columnReferences) {
+ this.sqlTemplate = sqlTemplate;
+ this.columnReferences = columnReferences;
+ }
+
+ public String injectAliases(OrderByAliasResolver aliasResolver) {
+ String sql = sqlTemplate;
+ for ( String columnReference : columnReferences ) {
+ final String replacementToken = "{" + columnReference + "}";
+ sql = sql.replace(
+ replacementToken,
+ aliasResolver.resolveTableAlias( columnReference ) + '.' + columnReference
+ );
+ }
+ return sql;
+ }
+ }
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByTranslation.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByTranslation.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderByTranslation.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,41 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Represents the result of an order-by translation by {@link @OrderByTranslator}
+ *
+ * @author Steve Ebersole
+ */
+public interface OrderByTranslation {
+ /**
+ * Inject table aliases into the translated fragment to properly qualify column references, using
+ * the given 'aliasResolver' to determine the the proper table alias to use for each column reference.
+ *
+ * @param aliasResolver The strategy to resolver the proper table alias to use per column
+ *
+ * @return The fully translated and replaced fragment.
+ */
+ public String injectAliases(OrderByAliasResolver aliasResolver);
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderingSpecification.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderingSpecification.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/OrderingSpecification.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,69 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Models an ordering specification (<tt>ASCENDING</tt> or <tt>DESCENDING</tt>) within a {@link SortSpecification}.
+ *
+ * @author Steve Ebersole
+ */
+public class OrderingSpecification extends NodeSupport {
+ public static class Ordering {
+ public static final Ordering ASCENDING = new Ordering( "asc" );
+ public static final Ordering DESCENDING = new Ordering( "desc" );
+
+ private final String name;
+
+ private Ordering(String name) {
+ this.name = name;
+ }
+ }
+
+ private boolean resolved;
+ private Ordering ordering;
+
+ public Ordering getOrdering() {
+ if ( !resolved ) {
+ ordering = resolve( getText() );
+ resolved = true;
+ }
+ return ordering;
+ }
+
+ private static Ordering resolve(String text) {
+ if ( Ordering.ASCENDING.name.equals( text ) ) {
+ return Ordering.ASCENDING;
+ }
+ else if ( Ordering.DESCENDING.name.equals( text ) ) {
+ return Ordering.DESCENDING;
+ }
+ else {
+ throw new IllegalStateException( "Unknown ordering [" + text + "]" );
+ }
+ }
+
+ public String getRenderableText() {
+ return getOrdering().name;
+ }
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortKey.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortKey.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortKey.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,34 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+
+/**
+ * Models the container node for the <tt>sort key</tt>, which is the term given by the ANSI SQL specification to the
+ * expression upon which to sort for each {@link SortSpecification}
+ *
+ * @author Steve Ebersole
+ */
+public class SortKey extends NodeSupport {
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortSpecification.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortSpecification.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SortSpecification.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,79 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import antlr.collections.AST;
+
+/**
+ * Models each sorting expression.
+ *
+ * @author Steve Ebersole
+ */
+public class SortSpecification extends NodeSupport {
+ /**
+ * Locate the specified {@link SortKey}.
+ *
+ * @return The sort key.
+ */
+ public SortKey getSortKey() {
+ return ( SortKey ) getFirstChild();
+ }
+
+ /**
+ * Locate the specified <tt>collation specification</tt>, if one.
+ *
+ * @return The <tt>collation specification</tt>, or null if none was specified.
+ */
+ public CollationSpecification getCollation() {
+ AST possible = getSortKey().getNextSibling();
+ return possible != null && OrderByTemplateTokenTypes.COLLATE == possible.getType()
+ ? ( CollationSpecification ) possible
+ : null;
+ }
+
+ /**
+ * Locate the specified <tt>ordering specification</tt>, if one.
+ *
+ * @return The <tt>ordering specification</tt>, or null if none was specified.
+ */
+ public OrderingSpecification getOrdering() {
+ // IMPL NOTE : the ordering-spec would be either the 2nd or 3rd child (of the overall sort-spec), if it existed,
+ // depending on whether a collation-spec was specified.
+
+ AST possible = getSortKey().getNextSibling();
+ if ( possible == null ) {
+ // There was no sort-spec parts specified other then the sort-key so there can be no ordering-spec...
+ return null;
+ }
+
+ if ( OrderByTemplateTokenTypes.COLLATE == possible.getType() ) {
+ // the 2nd child was a collation-spec, so we need to check the 3rd child instead.
+ possible = possible.getNextSibling();
+ }
+
+ return possible != null && OrderByTemplateTokenTypes.ORDER_SPEC == possible.getType()
+ ? ( OrderingSpecification ) possible
+ : null;
+ }
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SqlValueReference.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SqlValueReference.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/SqlValueReference.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,36 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2012, Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+/**
+ * Unifying interface between column and formula references mainly to give more strictly typed result
+ * to {@link ColumnMapper#map(String)}
+ *
+ * @see ColumnReference
+ * @see FormulaReference
+ *
+ * @author Steve Ebersole
+ */
+public interface SqlValueReference {
+}
Added: core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/TranslationContext.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/TranslationContext.java (rev 0)
+++ core/patches/JBPAPP-6940/src/org/hibernate/sql/ordering/antlr/TranslationContext.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -0,0 +1,63 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008 Red Hat Inc. 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 Inc.
+ *
+ * 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.sql.ordering.antlr;
+
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.function.SQLFunctionRegistry;
+import org.hibernate.engine.SessionFactoryImplementor;
+
+/**
+ * Contract for contextual information required to perform translation.
+*
+* @author Steve Ebersole
+*/
+public interface TranslationContext {
+ /**
+ * Retrieves the <tt>session factory</tt> for this context.
+ *
+ * @return The <tt>session factory</tt>
+ */
+ public SessionFactoryImplementor getSessionFactory();
+
+ /**
+ * Retrieves the <tt>dialect</tt> for this context.
+ *
+ * @return The <tt>dialect</tt>
+ */
+ public Dialect getDialect();
+
+ /**
+ * Retrieves the <tt>SQL function registry/tt> for this context.
+ *
+ * @return The SQL function registry.
+ */
+ public SQLFunctionRegistry getSqlFunctionRegistry();
+
+ /**
+ * Retrieves the <tt>column mapper</tt> for this context.
+ *
+ * @return The <tt>column mapper</tt>
+ */
+ public ColumnMapper getColumnMapper();
+}
Modified: core/patches/JBPAPP-6940/src/org/hibernate/util/StringHelper.java
===================================================================
--- core/patches/JBPAPP-6940/src/org/hibernate/util/StringHelper.java 2012-08-30 16:52:35 UTC (rev 21064)
+++ core/patches/JBPAPP-6940/src/org/hibernate/util/StringHelper.java 2012-08-30 16:55:39 UTC (rev 21065)
@@ -1,9 +1,10 @@
//$Id$
package org.hibernate.util;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.StringTokenizer;
-import java.util.ArrayList;
public final class StringHelper {
@@ -62,7 +63,13 @@
return buf.toString();
}
+ public static String repeat(char character, int times) {
+ char[] buffer = new char[times];
+ Arrays.fill( buffer, character );
+ return new String( buffer );
+ }
+
public static String replace(String template, String placeholder, String replacement) {
return replace( template, placeholder, replacement, false );
}
12 years, 2 months
Hibernate SVN: r21064 - core/patches/JBPAPP-6940.
by hibernate-commits@lists.jboss.org
Author: brmeyer
Date: 2012-08-30 12:52:35 -0400 (Thu, 30 Aug 2012)
New Revision: 21064
Added:
core/patches/JBPAPP-6940/build.xml
core/patches/JBPAPP-6940/doc/
core/patches/JBPAPP-6940/eg/
core/patches/JBPAPP-6940/etc/
core/patches/JBPAPP-6940/grammar/
core/patches/JBPAPP-6940/hibernate_logo.gif
core/patches/JBPAPP-6940/jdbc/
core/patches/JBPAPP-6940/lgpl.txt
core/patches/JBPAPP-6940/lib/
core/patches/JBPAPP-6940/src/
core/patches/JBPAPP-6940/test/
Log:
Branching for JBPAPP-6940
Copied: core/patches/JBPAPP-6940/build.xml (from rev 21063, core/branches/Branch_3_2_4_SP1_CP/build.xml)
===================================================================
--- core/patches/JBPAPP-6940/build.xml (rev 0)
+++ core/patches/JBPAPP-6940/build.xml 2012-08-30 16:52:35 UTC (rev 21064)
@@ -0,0 +1,643 @@
+<!--
+
+ Hibernate ANT build script.
+
+ (Originally contributed by Fabricio Goncalves)
+
+-->
+
+<project name="Hibernate3" default="jar" basedir=".">
+
+ <!-- ################################################################## -->
+ <!-- ################## Property definitions ########################## -->
+ <!-- ################################################################## -->
+
+ <!-- Give user a chance to override without editing this file or typing -D -->
+ <property file="build.properties"/>
+ <property file="${user.home}/.ant.properties"/>
+
+ <!-- Name of project and version, used to create filenames -->
+ <property name="Name" value="Hibernate"/>
+ <property name="name" value="hibernate"/>
+ <property name="name2" value="hibernate3"/>
+ <property name="version.major" value="3"/>
+ <property name="version.minor" value="2"/>
+ <property name="version.micro" value="4"/>
+ <property name="version.qualifier" value="sp1"/>
+ <property name="version.cp" value="cp11"/>
+ <property name="version.full"
+ value="${version.major}.${version.minor}.${version.micro}.${version.qualifier}.${version.cp}"/>
+ <property name="version.major_minor" value="${version.major}.${version.minor}"/>
+ <property name="fullname" value="${name}-${version.full}"/>
+
+ <!-- Various SCM-controlled directories -->
+ <property name="dir.src" value="src"/>
+ <property name="dir.test" value="test"/>
+ <property name="dir.grammar" value="grammar"/>
+ <property name="dir.etc" value="etc"/>
+ <property name="dir.lib" value="lib"/>
+ <property name="dir.jdbc" value="jdbc"/>
+ <property name="dir.doc" value="doc"/>
+ <property name="dir.doc.api" value="${dir.doc}/api"/>
+ <property name="dir.eg" value="eg"/>
+ <property name="dir.props" value="${dir.etc}"/>
+
+ <!-- Define the build directory layout -->
+ <property name="dir.build" value="build"/>
+ <property name="dir.out.classes" value="${dir.build}/classes"/>
+ <property name="dir.out.test-classes" value="${dir.build}/testclasses"/>
+ <property name="dir.out.generated-source" value="${dir.build}/gensrc"/>
+ <property name="dir.out.antlr-package" value="${dir.out.generated-source}/org/hibernate/hql/antlr"/>
+ <property name="dir.out.junit" value="${dir.build}/testout"/>
+ <property name="dir.out.junit-reports" value="${dir.build}/test-reports"/>
+ <property name="dir.out.perf-test" value="${dir.build}/testout-perf"/>
+ <property name="dir.out.db" value="${dir.build}/db"/>
+ <property name="dir.out.doc" value="${dir.build}/doc"/>
+ <property name="dir.out.eg" value="${dir.build}/eg"/>
+ <property name="dir.dist" value="${dir.build}/dist"/>
+
+ <!-- Define various operational options -->
+ <property name="javadoc.url.jse" value="http://java.sun.com/j2se/1.5.0/docs/api"/>
+ <property name="javac.debug" value="on"/>
+ <property name="javac.optimize" value="off"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="jar.driver" value="${dir.jdbc}/hsqldb.jar"/>
+
+ <!-- JAR and dist file names -->
+ <property name="jar.name" value="${name2}"/>
+ <property name="testjar.name" value="${name2}-test"/>
+
+ <property name="hibernate.test.validatefailureexpected" value="true"/>
+
+ <!-- fileset definition for the lib directory -->
+ <fileset id="fs.lib" dir="${dir.lib}">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset id="fs.lib.test" dir="${dir.lib}">
+ <include name="**/*.jar"/>
+ <exclude name="**/ant-*.jar"/>
+ </fileset>
+ <path id="path.lib">
+ <fileset refid="fs.lib"/>
+ </path>
+
+ <!-- fileset definition for the "supported" jars for distribution -->
+ <fileset id="fs.lib.dist" dir="${dir.lib}">
+ <include name="**/javassist.jar"/>
+ <include name="**/cglib.jar"/>
+ <include name="**/asm.jar"/>
+ <include name="**/asm-attrs.jar"/>
+ <include name="**/commons-collections.jar"/>
+ <include name="**/commons-logging.jar"/>
+ <include name="**/apache-1.1.txt"/>
+ <include name="**/apache-2.0.txt"/>
+ <include name="**/antlr.jar"/>
+ <include name="**/antlr.txt"/>
+ <include name="**/dom4j.jar"/>
+ <include name="**/jaxen.jar"/>
+ <include name="**/jboss-j2ee.jar"/>
+ <include name="**/jboss-cache-jdk50.jar"/>
+ <include name="**/concurrent.jar"/>
+ <include name="**/jboss-common.jar"/>
+ <include name="**/jboss-jmx.jar"/>
+ <include name="**/jboss-minimal.jar"/>
+ <include name="**/jboss-system.jar"/>
+ <include name="**/jgroups.jar"/>
+ <include name="**/version-dist.properties"/>
+ </fileset>
+
+ <!-- path definition for the JDBC driver(s) -->
+ <path id="path.jdbc">
+ <!-- By default include everything in the ${dir.jdbc} directory -->
+ <fileset dir="${dir.jdbc}">
+ <include name="**/*.jar"/>
+ <include name="**/*.zip"/>
+ </fileset>
+ <!-- And the explicitly defined jar.driver property (used by the CC scripts) -->
+ <pathelement path="${jar.driver}"/>
+ </path>
+ <!-- allows external definition of the JDBC classpath fragment -->
+ <property name="hibernate.test.jdbc.fs.importFile" value="doNotImport"/>
+ <import file="${hibernate.test.jdbc.fs.importFile}" optional="true"/>
+
+ <!-- patternset for insturmentation-eligible resources -->
+ <patternset id="ps.instrument.domain">
+ <include name="org/hibernate/test/instrument/domain/*"/>
+ <exclude name="**/*.hbm.xml"/>
+ </patternset>
+
+
+ <!-- ################################################################## -->
+ <!-- ############################# Tasks ############################## -->
+ <!-- ################################################################## -->
+
+ <!-- ################################################################## -->
+ <!-- ############################ Targets ############################# -->
+ <!-- ################################################################## -->
+
+ <!-- Various 'preparation targets -->
+
+ <target name="splash" unless="nosplash" description="Display the logo">
+ <property name="splash.dir" location="."/>
+ <splash imageurl="file:${splash.dir}/hibernate_logo.gif" showduration="0"/>
+ </target>
+
+ <target name="init" depends="splash" description="Initialize the build">
+ <tstamp>
+ <format property="now" pattern="yyyy-MM-dd hh:mm:ss"/>
+ </tstamp>
+ <echo message="Build ${Name}-${version.full} (${now})"/>
+ <echo message="JDK version: ${ant.java.version}"/>
+ </target>
+
+
+ <!-- Various 'clean' targets -->
+
+ <target name="clean" depends="init" description="Cleans up build directories">
+ <delete dir="${dir.build}"/>
+ </target>
+
+ <target name="cleantestdb" depends="init" description="Clean up the test file-based database directories">
+ <delete dir="${dir.out.db}"/>
+ </target>
+
+ <target name="init.antlr" depends="init" unless="antlr.isUpToDate" description="Check ANTLR dependencies.">
+ <uptodate property="antlr.isUpToDate" targetfile="${dir.out.antlr-package}/.antlr_run">
+ <srcfiles dir="${dir.grammar}" includes="*.g"/>
+ </uptodate>
+ </target>
+
+ <target name="antlr" depends="init.antlr" unless="antlr.isUpToDate" description="Generate ANTLR parsers.">
+ <mkdir dir="${dir.out.antlr-package}"/>
+ <antlr target="${dir.grammar}/hql.g" outputdirectory="${dir.out.antlr-package}">
+ <classpath refid="path.lib"/>
+ </antlr>
+ <antlr target="${dir.grammar}/hql-sql.g" outputdirectory="${dir.out.antlr-package}">
+ <classpath refid="path.lib"/>
+ </antlr>
+ <antlr target="${dir.grammar}/sql-gen.g" outputdirectory="${dir.out.antlr-package}">
+ <classpath refid="path.lib"/>
+ </antlr>
+ <touch file="${dir.out.antlr-package}/.antlr_run"/>
+ </target>
+
+ <target name="cleanantlr" depends="init" description="Clean up the generated ANTLR parsers.">
+ <delete dir="${dir.out.antlr-package}"/>
+ </target>
+
+ <target name="antlr.regen" depends="init,cleanantlr,antlr" description="Regenerate all ANTLR generated code."/>
+
+ <target name="antlr.bnf" depends="init" description="Generate BNF diagram for HQL">
+ <mkdir dir="${dir.out.doc}/other"/>
+ <property name="bnf.grammar" location="${dir.grammar}/hql.g"/>
+
+ <java dir="${dir.out.doc}/other" classname="net.mark_malakanov.sdg2.Main" classpathref="path.lib" fork="true">
+ <jvmarg line="-Xmx512M"/>
+ <arg line="-blind"/>
+ <arg line="-savehtml hql-bnf.html"/>
+ <arg line="-savehtmltitle Hibernate ${version.full} HQL"/>
+ <arg line="${bnf.grammar}"/>
+ </java>
+ </target>
+
+
+ <!-- Compilation targets -->
+
+ <target name="compile" depends="init,antlr" unless="classes.isUpToDate" description="Compile the Java source code">
+ <mkdir dir="${dir.out.classes}"/>
+ <available classname="org.eclipse.core.launcher.Main" property="build.compiler"
+ value="org.eclipse.jdt.core.JDTCompilerAdapter" classpath="${java.class.path}"/>
+ <javac destdir="${dir.out.classes}"
+ classpathref="path.lib"
+ debug="${javac.debug}"
+ optimize="${javac.optimize}"
+ target="${javac.target}"
+ source="${javac.source}"
+ nowarn="on">
+ <src path="${dir.src}"/>
+ <src path="${dir.out.generated-source}"/>
+ </javac>
+ <copy todir="${dir.out.classes}">
+ <fileset dir="${dir.src}">
+ <include name="**/*.dtd"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xslt"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="compiletest" depends="compile" unless="test-classes.isUpToDate" description="Compile the tests">
+ <mkdir dir="${dir.out.test-classes}"/>
+ <available classname="org.eclipse.core.launcher.Main" property="build.compiler"
+ value="org.eclipse.jdt.core.JDTCompilerAdapter" classpath="${java.class.path}"/>
+ <javac destdir="${dir.out.test-classes}"
+ debug="${javac.debug}"
+ optimize="${javac.optimize}"
+ target="${javac.target}"
+ source="${javac.source}"
+ nowarn="on">
+ <classpath>
+ <path refid="path.lib"/>
+ <pathelement path="${dir.out.classes}"/>
+ </classpath>
+ <src path="${dir.test}"/>
+ </javac>
+ <copy todir="${dir.out.test-classes}">
+ <fileset dir="${dir.test}">
+ <include name="**/*.xml"/>
+ <include name="**/*.properties"/>
+ </fileset>
+ </copy>
+ </target>
+
+
+ <!-- testsuite targets -->
+
+ <target name="junitreport"
+ depends="splash,junit"
+ description="Run tests and create JUnit report (requires driver.jar property)">
+ <delete dir="${dir.out.junit-reports}"/>
+ <mkdir dir="${dir.out.junit-reports}"/>
+ <junitreport todir="${dir.out.junit-reports}">
+ <fileset dir="${dir.out.junit}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${dir.out.junit-reports}"/>
+ </junitreport>
+ </target>
+
+ <target name="junitreport-dist"
+ depends="splash,prepare-dist,junitreport"
+ description="Run tests using distribution jars and create JUnit report (requires driver.jar property)"/>
+
+ <target name="prepare-dist" depends="init" description="Unzip jar and test jar to be use in distribution">
+ <mkdir dir="${dir.build}"/>
+ <delete dir="${dir.out.classes}"/>
+ <mkdir dir="${dir.out.classes}"/>
+ <delete dir="${dir.out.test-classes}"/>
+ <mkdir dir="${dir.out.test-classes}"/>
+ <unzip src="${basedir}/${jar.name}.jar" dest="${dir.out.classes}"/>
+ <unzip src="${basedir}/${testjar.name}.jar" dest="${dir.out.test-classes}"/>
+ <delete dir="${dir.out.generated-source}"/>
+ <available file="${dir.out.classes}/org/hibernate/hql/antlr"
+ type="dir"
+ property="antlr.isUpToDate"/>
+ <available file="${dir.out.classes}/org/hibernate"
+ type="dir"
+ property="classes.isUpToDate"/>
+ <available file="${dir.out.test-classes}/org/hibernate/test"
+ type="dir"
+ property="test-classes.isUpToDate"/>
+ <property name="test-classes.isFromJar" value="$test-classes.isUpToDate"/>
+ <echo message="antlr.isUpToDate=${antlr.isUpToDate}"/>
+ <echo message="classes.isUpToDate=${classes.isUpToDate}"/>
+ <echo message="test-classes.isUpToDate=${test-classes.isUpToDate}"/>
+ </target>
+
+ <target name="junit" depends="junit.prepare">
+ <sequential>
+ <antcall target="junit.standard"/>
+ <antcall target="junit.instrument.cglib"/>
+ <antcall target="junit.instrument.javassist"/>
+ </sequential>
+ </target>
+
+ <target name="junit.prepare" depends="cleantestdb,compiletest">
+ <delete dir="${dir.out.junit}"/>
+ <mkdir dir="${dir.out.junit}"/>
+ </target>
+
+ <target name="junit.standard"
+ depends="junit.prepare"
+ description="Run the test suite (requires driver.jar property)">
+ <path id="selector.classpath">
+ <!--
+ the selector needs all of this because it actually gets the suite
+ from AllTests and then performs the filtering based on that
+ -->
+ <fileset refid="fs.lib.test"/>
+ <path refid="path.jdbc"/>
+ <pathelement path="${dir.out.classes}"/>
+ <pathelement path="${dir.out.test-classes}"/>
+ <pathelement path="${dir.props}"/>
+ </path>
+
+ <junit printsummary="on" dir="${basedir}" maxmemory="256M" fork="yes" forkmode="perBatch">
+ <jvmarg value="-Dhibernate.test.validatefailureexpected=${hibernate.test.validatefailureexpected}"/>
+ <classpath>
+ <fileset refid="fs.lib.test"/>
+ <path refid="path.jdbc"/>
+ <pathelement path="${dir.out.classes}"/>
+ <pathelement path="${dir.out.test-classes}"/>
+ <pathelement path="${dir.props}"/>
+ </classpath>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest todir="${dir.out.junit}" haltonfailure="no">
+ <fileset dir="${dir.out.test-classes}">
+ <include name="org/hibernate/test/**/*Test.class"/>
+ <!-- exclude the build-time instrumentation tasks as we will be running them manually shortly -->
+ <exclude name="org/hibernate/test/instrument/buildtime/*"/>
+ <!--custom selector to make sure only those tests in the AllTests suite get picked up here -->
+ <custom classname="org.hibernate.test.TestSelector" classpathref="selector.classpath"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="junit.instrument" depends="junit.prepare,junit.instrument.cglib,junit.instrument.javassist"/>
+
+ <target name="junit.instrument.cglib" depends="instrument.cglib">
+ <mkdir dir="${dir.out.junit}"/>
+ <junit printsummary="yes" maxmemory="256M" fork="yes">
+ <jvmarg value="-Dhibernate.test.validatefailureexpected=${hibernate.test.validatefailureexpected}"/>
+ <classpath>
+ <fileset refid="fs.lib.test"/>
+ <path refid="path.jdbc"/>
+ <pathelement path="${dir.out.classes}"/>
+ <pathelement path="${dir.out.test-classes}"/>
+ <pathelement path="${dir.props}"/>
+ </classpath>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <test name="org.hibernate.test.instrument.buildtime.InstrumentTest"
+ outfile="TEST-CGLIB-org.hibernate.test.instrument.buildtime.InstrumentTest"
+ todir="${dir.out.junit}"
+ haltonerror="false"
+ haltonfailure="false"/>
+ </junit>
+ </target>
+
+ <target name="junit.instrument.javassist" depends="instrument.javassist">
+ <mkdir dir="${dir.out.junit}"/>
+ <junit printsummary="yes" maxmemory="256M" fork="yes">
+ <jvmarg value="-Dhibernate.test.validatefailureexpected=${hibernate.test.validatefailureexpected}"/>
+ <classpath>
+ <fileset refid="fs.lib.test"/>
+ <path refid="path.jdbc"/>
+ <pathelement path="${dir.out.classes}"/>
+ <pathelement path="${dir.out.test-classes}"/>
+ <pathelement path="${dir.props}"/>
+ </classpath>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <test name="org.hibernate.test.instrument.buildtime.InstrumentTest"
+ outfile="TEST-JAVASSIST-org.hibernate.test.instrument.buildtime.InstrumentTest"
+ todir="${dir.out.junit}"
+ haltonerror="false"
+ haltonfailure="false"/>
+ </junit>
+ </target>
+
+ <!-- Run a single unit test. -->
+ <target name="junitsingle"
+ depends="cleantestdb,compiletest"
+ description="Run a single test suite (requires testname and jar.driver properties)">
+ <delete dir="${dir.out.junit}"/>
+ <mkdir dir="${dir.out.junit}"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes" dir="${basedir}">
+ <classpath>
+ <fileset refid="fs.lib.test"/>
+ <path refid="path.jdbc"/>
+ <pathelement path="${dir.out.classes}"/>
+ <pathelement path="${dir.out.test-classes}"/>
+ <pathelement path="${dir.props}"/>
+ </classpath>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <test fork="yes" todir="${dir.out.junit}" haltonfailure="no" name="${testname}"/>
+ </junit>
+ </target>
+
+ <!-- Instrumentation tasks -->
+
+ <target name="instrument.clean">
+ <delete>
+ <fileset dir="${dir.out.test-classes}">
+ <patternset refid="ps.instrument.domain"/>
+ </fileset>
+ </delete>
+ </target>
+
+
+ <target name="instrument.prepare-from-testjar" depends="instrument.clean" if="test-classes.isFromJar">
+ <unzip src="${basedir}/${testjar.name}.jar" dest="${dir.out.test-classes}"/>
+ </target>
+
+ <target name="instrument.prepare" depends="instrument.prepare-from-testjar" unless="test-classes.isFromJar">
+ <available classname="org.eclipse.core.launcher.Main" property="build.compiler"
+ value="org.eclipse.jdt.core.JDTCompilerAdapter" classpath="${java.class.path}"/>
+ <javac destdir="${dir.out.test-classes}"
+ debug="${javac.debug}"
+ optimize="${javac.optimize}"
+ target="${javac.target}"
+ source="${javac.source}"
+ nowarn="on">
+ <classpath>
+ <path refid="path.lib"/>
+ <pathelement path="${dir.out.classes}"/>
+ </classpath>
+ <src path="${dir.test}"/>
+ <patternset refid="ps.instrument.domain"/>
+ </javac>
+ </target>
+
+
+ <target name="instrument.cglib"
+ depends="instrument.prepare,compiletest"
+ description="Performs cglib-based instrumentation">
+ <taskdef name="instrument" classname="org.hibernate.tool.instrument.cglib.InstrumentTask">
+ <classpath path="${dir.out.classes}"/>
+ <classpath refid="path.lib"/>
+ </taskdef>
+ <instrument verbose="true">
+ <fileset dir="${dir.out.test-classes}">
+ <patternset refid="ps.instrument.domain"/>
+ </fileset>
+ </instrument>
+ </target>
+
+ <target name="instrument.javassist"
+ depends="instrument.prepare,compiletest"
+ description="Performs javassist-based instrumentation">
+ <taskdef name="instrument" classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
+ <classpath path="${dir.out.classes}"/>
+ <classpath refid="path.lib"/>
+ </taskdef>
+ <instrument verbose="true">
+ <fileset dir="${dir.out.test-classes}">
+ <patternset refid="ps.instrument.domain"/>
+ </fileset>
+ </instrument>
+ </target>
+
+ <!-- Distribution related targets -->
+
+ <target name="jar" depends="compile" description="Build the distribution .jar file">
+ <mkdir dir="${dir.build}"/>
+
+ <jar jarfile="${dir.build}/${jar.name}.jar" basedir="${dir.out.classes}">
+ <include name="org/hibernate/**/*.class"/>
+ <include name="org/hibernate/*.dtd"/>
+ <manifest>
+ <attribute name="Implementation-Title" value="Hibernate3"/>
+ <attribute name="Implementation-Version" value="${version.full}"/>
+ <attribute name="Implementation-Vendor" value="hibernate.org"/>
+ <attribute name="Hibernate-Version" value="${version.full}"/>
+ </manifest>
+ </jar>
+
+ <!-- currently for testing *only* -->
+ <jar jarfile="${dir.build}/hibernate3-client.jar">
+ <zipfileset src="${dir.build}/${jar.name}.jar">
+ <include name="org/hibernate/AssertionFailure.class"/>
+ <include name="org/hibernate/**/*Exception.class"/>
+ <include name="org/hibernate/collection/**"/>
+ <include name="org/hibernate/exception/Nestable*.class"/>
+ <include name="org/hibernate/exception/ExceptionUtils.class"/>
+ <include name="org/hibernate/engine/SessionImplementor.class"/>
+ <include name="org/hibernate/loader/CollectionAliases.class"/>
+ <include name="org/hibernate/persister/collection/**"/>
+ <include name="org/hibernate/pretty/MessageHelper.class"/>
+ <include name="org/hibernate/type/Type.class"/>
+ <include name="org/hibernate/EntityMode.class"/>
+ <include name="org/hibernate/util/**"/>
+ <include name="org/hibernate/proxy/**"/>
+ </zipfileset>
+ <manifest>
+ <attribute name="Implementation-Title" value="Hibernate3 Client"/>
+ <attribute name="Implementation-Version" value="${version.full}"/>
+ <attribute name="Implementation-Vendor" value="hibernate.org"/>
+ <attribute name="Hibernate-Version" value="${version.full}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="testjar" depends="compiletest" description="Build the distribution test .jar file">
+ <mkdir dir="${dir.build}"/>
+ <jar jarfile="${dir.build}/${testjar.name}.jar" basedir="${dir.out.test-classes}">
+ <include name="org/hibernate/**/*"/>
+
+ <manifest>
+ <attribute name="Implementation-Title" value="Hibernate3-test"/>
+ <attribute name="Implementation-Version" value="${version.full}"/>
+ <attribute name="Implementation-Vendor" value="hibernate.org"/>
+ <attribute name="Hibernate-Version" value="${version.full}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="dist" depends="init,jar,testjar,javadoc"
+ description="Build everything and package">
+ <mkdir dir="${dir.dist}"/>
+
+ <!-- prepare build.xml -->
+ <copy file="${basedir}/build.xml" todir="${dir.dist}"/>
+ <replace file="${dir.dist}/build.xml">
+ <replacetoken><![CDATA[../${name}-${version}]]></replacetoken>
+ <replacevalue><![CDATA[../${name}]]></replacevalue>
+ </replace>
+ <replace file="${dir.dist}/build.xml">
+ <replacetoken><![CDATA[name="dir.jdbc" value="jdbc"]]></replacetoken>
+ <replacevalue><![CDATA[name="dir.jdbc" value="lib"]]></replacevalue>
+ </replace>
+
+ <zip zipfile="${dir.dist}/${fullname}.zip">
+ <zipfileset prefix="${name}-${version.major_minor}" file="${dir.build}/${jar.name}.jar"/>
+ <zipfileset prefix="${name}-${version.major_minor}/eg" dir="${dir.eg}"/>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${basedir}/build.bat"/>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${basedir}/build.sh"/>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${dir.dist}/build.xml"/>
+ <zipfileset prefix="${name}-${version.major_minor}/etc" dir="${dir.etc}">
+ <exclude name="ehcache.xml"/>
+ <exclude name="oscache.properties"/>
+ </zipfileset>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${basedir}/lgpl.txt"/>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${basedir}/JBossORG-EULA.txt"/>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${basedir}/readme.txt"/>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${dir.build}/${testjar.name}.jar"/>
+ <zipfileset prefix="${name}-${version.major_minor}" file="${basedir}/hibernate_logo.gif"/>
+ </zip>
+ <checksum file="${dir.dist}/${fullname}.zip" algorithm="MD5" fileext=".md5.txt"/>
+
+ <zip zipfile="${dir.dist}/${fullname}-src.zip">
+ <zipfileset prefix="${name}-${version.major_minor}-src/src" dir="${dir.src}"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src/grammar" dir="${dir.grammar}"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src/grammar/gensrc" dir="${dir.out.generated-source}"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src/test" dir="${dir.test}"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src/eg" dir="${dir.eg}"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src" file="${basedir}/build.bat"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src" file="${basedir}/build.sh"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src" file="${dir.dist}/build.xml"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src/etc" dir="${dir.etc}">
+ <exclude name="ehcache.xml"/>
+ <exclude name="oscache.properties"/>
+ </zipfileset>
+ <zipfileset prefix="${name}-${version.major_minor}-src" file="${basedir}/hibernate_logo.gif"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src" file="${basedir}/lgpl.txt"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src" file="${basedir}/JBossORG-EULA.txt"/>
+ <zipfileset prefix="${name}-${version.major_minor}-src" file="${basedir}/readme.txt"/>
+ </zip>
+ <checksum file="${dir.dist}/${fullname}-src.zip" algorithm="MD5" fileext=".md5.txt"/>
+
+ <delete file="${dir.dist}/build.xml"/>
+ </target>
+
+ <target name="dist.complete" depends="init,jar,javadoc,antlr.bnf"
+ description="Build and package everything, and run test suite and eg example">
+ <!-- perform a call to the junit target -->
+ <antcall target="junitreport"/>
+ <antcall target="dist"/>
+ </target>
+
+
+ <!-- Documentation related targets -->
+
+ <target name="javadoc" description="Compile the Javadoc API documentation to dist dir" depends="splash,antlr">
+ <mkdir dir="${dir.out.doc}/api"/>
+ <javadoc classpathref="path.lib"
+ destdir="${dir.out.doc}/api"
+ use="true"
+ protected="true"
+ version="true"
+ doctitle="${Name} API Documentation (${version.full})"
+ windowtitle="${Name} API Documentation"
+ Overview="${dir.doc.api}/package.html"
+ stylesheetfile="${dir.doc.api}/jdstyle.css"
+ source="${javac.source}"
+ link="${javadoc.url.jse}">
+ <packageset dir="${dir.out.generated-source}" defaultexcludes="yes">
+ <include name="org/hibernate/**"/>
+ </packageset>
+ <packageset dir="${dir.src}" defaultexcludes="yes">
+ <include name="org/hibernate/**"/>
+ </packageset>
+ <group title="Core API"
+ packages="org.hibernate:org.hibernate.classic:org.hibernate.criterion:org.hibernate.metadata:org.hibernate.cfg:org.hibernate.usertype"/>
+ <group title="Extension API"
+ packages="org.hibernate.id:org.hibernate.connection:org.hibernate.transaction:org.hibernate.type:org.hibernate.dialect*:org.hibernate.cache*:org.hibernate.event*:org.hibernate.action:org.hibernate.property:org.hibernate.loader*:org.hibernate.persister*:org.hibernate.proxy:org.hibernate.tuple:org.hibernate.transform:org.hibernate.collection:org.hibernate.jdbc"/>
+ <group title="Miscellaneous API"
+ packages="org.hibernate.stat:org.hibernate.tool.hbm2ddl:org.hibernate.jmx:org.hibernate.mapping:org.hibernate.tool.instrument"/>
+ <group title="Internal Implementation"
+ packages="org.hibernate.engine:org.hibernate.impl:org.hibernate.sql:org.hibernate.lob:org.hibernate.util:org.hibernate.exception:org.hibernate.hql:org.hibernate.hql.ast:org.hibernate.hql.antlr:org.hibernate.hql.classic:org.hibernate.intercept:org.hibernate.secure:org.hibernate.pretty"/>
+ </javadoc>
+ <copy file="${dir.doc.api}/package.html" todir="${dir.out.doc}/api"/>
+ </target>
+
+
+ <target name="prepare-dir-up" depends="jar">
+ <!-- for backwards compatibility with where the tools expect to find the jar and libs -->
+ <property name="targetdir" value="../${name}-${version.major_minor}"/>
+ <mkdir dir="${targetdir}"/>
+ <mkdir dir="${targetdir}/lib"/>
+
+ <copy todir="${targetdir}" file="${dir.build}/${jar.name}.jar"/>
+ <copy todir="${targetdir}/lib">
+ <fileset dir="${dir.lib}"/>
+ </copy>
+
+ <copy todir="${targetdir}/doc/api" file="${dir.doc.api}/jdstyle.css"/>
+ </target>
+
+</project>
Copied: core/patches/JBPAPP-6940/hibernate_logo.gif (from rev 21063, core/branches/Branch_3_2_4_SP1_CP/hibernate_logo.gif)
===================================================================
(Binary files differ)
Copied: core/patches/JBPAPP-6940/lgpl.txt (from rev 21063, core/branches/Branch_3_2_4_SP1_CP/lgpl.txt)
===================================================================
--- core/patches/JBPAPP-6940/lgpl.txt (rev 0)
+++ core/patches/JBPAPP-6940/lgpl.txt 2012-08-30 16:52:35 UTC (rev 21064)
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
12 years, 2 months
Hibernate SVN: r21063 - core/patches.
by hibernate-commits@lists.jboss.org
Author: brmeyer
Date: 2012-08-30 12:50:00 -0400 (Thu, 30 Aug 2012)
New Revision: 21063
Added:
core/patches/JBPAPP-6940/
Log:
Branching for JBPAPP-6940
12 years, 2 months
Hibernate SVN: r21062 - annotations/patches/JBPAPP-6940.
by hibernate-commits@lists.jboss.org
Author: brmeyer
Date: 2012-08-30 12:49:40 -0400 (Thu, 30 Aug 2012)
New Revision: 21062
Added:
annotations/patches/JBPAPP-6940/.cvsignore
annotations/patches/JBPAPP-6940/build.properties.dist
annotations/patches/JBPAPP-6940/build.xml
annotations/patches/JBPAPP-6940/doc/
annotations/patches/JBPAPP-6940/jdbc/
annotations/patches/JBPAPP-6940/lgpl.txt
annotations/patches/JBPAPP-6940/lib/
annotations/patches/JBPAPP-6940/readme.txt
annotations/patches/JBPAPP-6940/src/
Log:
Branching for JBPAPP-6940
Copied: annotations/patches/JBPAPP-6940/.cvsignore (from rev 21061, annotations/branches/v3_3_1_GA_CP/.cvsignore)
===================================================================
--- annotations/patches/JBPAPP-6940/.cvsignore (rev 0)
+++ annotations/patches/JBPAPP-6940/.cvsignore 2012-08-30 16:49:40 UTC (rev 21062)
@@ -0,0 +1,9 @@
+target
+build
+build.properties
+test_output
+testout
+common-build.xml
+javadoc.bat
+build.properties
+instrumenttestout
Copied: annotations/patches/JBPAPP-6940/build.properties.dist (from rev 21061, annotations/branches/v3_3_1_GA_CP/build.properties.dist)
===================================================================
--- annotations/patches/JBPAPP-6940/build.properties.dist (rev 0)
+++ annotations/patches/JBPAPP-6940/build.properties.dist 2012-08-30 16:49:40 UTC (rev 21062)
@@ -0,0 +1,8 @@
+common.dir=.
+src.dir=src
+test.dir=test
+hibernate-core.home=../hibernate-3.2
+
+#locally present jars
+jpa-api.jar=./lib/ejb3-persistence.jar
+commons-annotations.jar=./lib/hibernate-commons-annotations.jar
\ No newline at end of file
Copied: annotations/patches/JBPAPP-6940/build.xml (from rev 21061, annotations/branches/v3_3_1_GA_CP/build.xml)
===================================================================
--- annotations/patches/JBPAPP-6940/build.xml (rev 0)
+++ annotations/patches/JBPAPP-6940/build.xml 2012-08-30 16:49:40 UTC (rev 21062)
@@ -0,0 +1,361 @@
+<!--
+
+ Hibernate Annotations ANT build script.
+
+ You need JDK 5.0 installed to build Hibernate Annotations.
+
+-->
+
+<project name="Hibernate Annotations" default="dist" basedir=".">
+
+ <!-- Give user a chance to override without editing this file
+ (and without typing -D each time it compiles it) -->
+ <property file="build.properties"/>
+ <property file="${user.home}/.ant.properties"/>
+
+ <!-- Name of project and version, used to create filenames -->
+ <property name="Name" value="Hibernate Annotations"/>
+ <property name="name" value="hibernate-annotations"/>
+ <property name="version" value="3.3.1.GA.CP04"/>
+ <property name="javadoc.packagenames" value="org.hibernate.*"/>
+ <property name="jdbc.dir" value="jdbc"/>
+ <property name="copy.test" value="true"/>
+ <property name="src.dir" location="src/java"/>
+ <property name="test.dir" location="src/test"/>
+ <property name="lib.dir" location="lib"/>
+ <property name="build.dir" location="build"/>
+ <property name="classes.dir" location="${build.dir}/classes"/>
+ <property name="testclasses.dir" location="${build.dir}/testclasses"/>
+ <property name="dist.target.dir" location="target"/>
+ <property name="dist.dir" location="${build.dir}/${name}"/>
+ <property name="instrumenttest.out.dir" value="instrumenttestout"/>
+ <property name="doc.dir" location="doc"/>
+ <property name="doc.api.dir" location="${doc.dir}/api"/>
+ <property name="doc.reference.dir" location="${doc.dir}/reference"/>
+ <property name="dist.doc.dir" location="${dist.dir}/doc"/>
+ <property name="dist.api.dir" location="${dist.dir}/doc/api"/>
+ <property name="dist.src.dir" location="${dist.dir}/src"/>
+ <property name="dist.test.dir" location="${dist.dir}/test"/>
+ <property name="dist.lib.dir" location="${dist.dir}/lib"/>
+ <property name="jar.name" value="${name}"/>
+ <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/>
+ <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/>
+ <property name="javac.debug" value="on"/>
+ <property name="javac.optimize" value="off"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="javac.target" value="1.5"/>
+ <available property="jpa-present" file="${basedir}/../jpa-api" type="dir"/>
+ <property name="jpa-javadoc.dir" value="${dist.doc.dir}/jpa-api"/>
+ <property name="test.output.dir" value="${build.dir}/test_output"/>
+ <!-- set Hibernate core related properties -->
+ <property name="hibernate-core.home" location="../core"/>
+ <property name="hibernate-core.jar" location="${hibernate-core.home}/hibernate3.jar"/>
+ <property name="hibernate-core.lib.dir" location="${hibernate-core.home}/lib"/>
+ <path id="lib.class.path">
+ <path location="${hibernate-core.jar}" />
+ <fileset dir="${hibernate-core.lib.dir}">
+ <include name="*.jar"/>
+ <exclude name="ant-*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+ <path id="junit.classpath">
+ <pathelement path="${classes.dir}"/>
+ <pathelement path="${testclasses.dir}"/>
+ <path refid="lib.class.path"/>
+ <pathelement location="${src.dir}"/>
+ <pathelement location="${test.dir}"/>
+ <fileset dir="${jdbc.dir}">
+ <include name="**/*.jar"/>
+ <include name="**/*.zip"/>
+ </fileset>
+ </path>
+ <patternset id="support.files">
+ <include name="**/*.jpg"/>
+ <include name="**/*.gif"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.xsd"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xslt"/>
+
+ <!-- exclude everything we don't want in the jar -->
+ <exclude name="${build.dir}/**/*"/>
+ <exclude name="${doc.dir}/**/*"/>
+ <exclude name="classes/**/*"/>
+ <exclude name="build.xml"/>
+ <exclude name="**/*.properties"/>
+ <exclude name="**/*.ccf"/>
+ <exclude name="**/*.cfg.xml"/>
+ <exclude name="**/ehcache.xml"/>
+ </patternset>
+
+ <patternset id="source.files">
+ <include name="**/*.java"/>
+ <include name="**/*.properties"/>
+ </patternset>
+
+ <!-- junit paths/filesets -->
+ <fileset dir="${testclasses.dir}" id="junit.batchtestset">
+ <include name="**/*Test.class"/>
+ </fileset>
+
+ <path id="testsrc.path">
+ <pathelement location="${test.dir}"/>
+ </path>
+
+ <target name="info" description="Echoes useful system properties">
+ <echo message="java.vm.info=${java.vm.info}"/>
+ <echo message="java.vm.name=${java.vm.name}"/>
+ <echo message="java.vm.vendor=${java.vm.vendor}"/>
+ <echo message="java.vm.version=${java.vm.version}"/>
+ <echo message="os.arch=${os.arch}"/>
+ <echo message="os.name=${os.name}"/>
+ <echo message="os.version=${os.version}"/>
+ <echo message="java.home = ${java.home}"/>
+ <echo message="java.class.path = ${java.class.path}"/>
+ <echo message="file.encoding=${file.encoding}"/>
+ <echo message="user.home = ${user.home}"/>
+ <echo message="user.language=${user.language}"/>
+ </target>
+ <target name="init" description="Initialize the build">
+ <tstamp>
+ <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/>
+ </tstamp>
+ <echo message="Build ${Name}-${version} (${subversion})"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${testclasses.dir}"/>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${build.dir}">
+ <fileset dir=".">
+ <include name="readme.txt"/>
+ <include name="lgpl.txt"/>
+ </fileset>
+ </copy>
+
+ <available file="${hibernate-core.jar}" type="file" property="hibernate-core.jar.available"/>
+ <fail unless="hibernate-core.jar.available" message="Cannot locate hibernate-core.jar: ${hibernate-core.jar}"/>
+ </target>
+ <target name="clean" description="Cleans up build and dist directories">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.target.dir}"/>
+ </target>
+ <target name="compile" depends="init"
+ description="Compile the Java source code">
+ <javac
+ srcdir="${src.dir}"
+ destdir="${classes.dir}"
+ classpathref="lib.class.path"
+ debug="${javac.debug}"
+ optimize="${javac.optimize}"
+ nowarn="on"
+ source="${javac.source}"
+ target="${javac.target}">
+ <src path="${src.dir}"/>
+ </javac>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}">
+ <include name="**/resources/*.properties"/>
+ <include name="**/*.xsd"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="compiletest" depends="compile" description="Compile the tests">
+ <javac
+ destdir="${testclasses.dir}"
+ classpathref="junit.classpath"
+ debug="${javac.debug}"
+ optimize="${javac.optimize}"
+ nowarn="on"
+ source="${javac.source}"
+ target="${javac.target}">
+ <src refid="testsrc.path"/>
+ </javac>
+ </target>
+ <target name="junit" depends="compiletest">
+ <mkdir dir="${test.output.dir}"/>
+ <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
+ <classpath>
+ <fileset dir="${hibernate-core.lib.dir}">
+ <include name="junit-*.jar"/>
+ <include name="ant-junit-*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+ <junit printsummary="on" haltonfailure="on" forkmode="once">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest fork="yes" todir="${test.output.dir}" haltonfailure="no">
+ <fileset refid="junit.batchtestset"/>
+ </batchtest>
+ </junit>
+ </target>
+ <!-- Run a single unit test. -->
+ <target name="junitsingle" depends="compiletest"
+ description="Run a single test suite (requires testname and jdbc.driver properties)">
+ <mkdir dir="${test.output.dir}"/>
+ <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
+ <classpath>
+ <fileset dir="${hibernate-core.lib.dir}">
+ <include name="junit-*.jar"/>
+ <include name="ant-junit-*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+ <junit printsummary="on" fork="yes" haltonfailure="on">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <test fork="yes" todir="${test.output.dir}" haltonfailure="no" name="${testname}"/>
+ </junit>
+ </target>
+ <!-- actually this instrument target is broken, I will fix it soon
+ <target name="junitinstrument" depends="compiletest,instrument"
+ description="Run the instrument test suite (requires driver.jar property)">
+ <mkdir dir="${instrumenttest.out.dir}"/>
+ <junit printsummary="yes" haltonfailure="yes" dir="${basedir}"
+ maxmemory="256M" fork="yes" forkmode="perBatch">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest todir="${instrumenttest.out.dir}" haltonfailure="no">
+ <fileset dir="${classes.dir}">
+ <include name="org/hibernate/test/**/*Test.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+-->
+ <target name="junitreport" depends="junit">
+ <taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
+ <classpath>
+ <fileset dir="${hibernate-core.lib.dir}">
+ <include name="junit-*.jar"/>
+ <include name="ant-junit-*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+ <junitreport todir="${test.output.dir}">
+ <fileset dir="${test.output.dir}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${test.output.dir}"/>
+ </junitreport>
+ </target>
+
+ <target name="jar" depends="compile" description="Build the distribution .jar file">
+ <mkdir dir="${classes.dir}/META-INF"/>
+ <manifest file="${classes.dir}/META-INF/MANIFEST.MF">
+ <attribute name="Implementation-Title" value="${Name}"/>
+ <attribute name="Implementation-Version" value="${version}"/>
+ <attribute name="Implementation-Vendor" value="hibernate.org"/>
+ <attribute name="Implementation-Vendor-Id" value="hibernate.org"/>
+ <attribute name="Implementation-URL" value="http://annotations.hibernate.org"/>
+ <attribute name="Specification-Title" value="Java Persistence"/>
+ <attribute name="Specification-Version" value="1.0"/>
+ <attribute name="Specification-Vendor" value="jcp.org"/>
+ </manifest>
+ <mkdir dir="${dist.dir}"/>
+ <jar filesetmanifest="merge" jarfile="${jar.file.name}" basedir="${classes.dir}"/>
+ </target>
+ <target name="javadoc" description="Compile the Javadoc API documentation to dist dir">
+ <mkdir dir="${dist.api.dir}"/>
+ <javadoc
+ packagenames="${javadoc.packagenames}"
+ classpathref="lib.class.path"
+ destdir="${dist.api.dir}"
+ use="true"
+ protected="true"
+ version="true"
+ windowtitle="${Name} API Documentation"
+ Overview="${doc.api.dir}/package.html"
+ doctitle="${Name} API Documentation"
+ stylesheetfile="${doc.api.dir}/jdstyle.css"
+ link="http://java.sun.com/j2se/1.5.0/docs/api/">
+ <packageset dir="${src.dir}" defaultexcludes="yes" >
+ <include name="**/*" />
+ </packageset>
+ </javadoc>
+ </target>
+ <target name="jpa-javadoc" if="jpa-present">
+ <mkdir dir="${jpa-javadoc.dir}"/>
+ <ant dir="../jpa-api" target="javadoc" inheritAll="false"/>
+ <copy todir="${jpa-javadoc.dir}">
+ <fileset dir="${basedir}/../jpa-api/build/api">
+ <include name="**/*.*"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="dist" depends="jar,jartest,javadoc,jpa-javadoc,copytest,copysource"
+ description="Build everything">
+ <copy todir="${dist.dir}" failonerror="false">
+ <fileset dir="${common.dir}">
+ <include name="common-build.xml"/>
+ </fileset>
+ </copy>
+ <copy todir="${dist.lib.dir}" failonerror="false">
+ <fileset file="${lib.dir}/*.*"/>
+ </copy>
+ <copy file="readme.txt" todir="${dist.dir}"/>
+ <copy file="lgpl.txt" todir="${dist.dir}"/>
+ <copy file="changelog.txt" todir="${dist.dir}"/>
+ <copy file="build.xml" todir="${dist.dir}"/>
+ <copy file="${basedir}/build.properties.dist" tofile="${dist.dir}/build.properties" failonerror="false" />
+ <zip zipfile = "${dist.dir}-${version}.zip">
+ <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </zip>
+ <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
+ <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </tar>
+ </target>
+ <!-- actually this target is broken, will be fixed soon
+ <target name="instrument" depends="compiletest"
+ description="Instrument the persistent classes">
+
+ <taskdef name="instrument" classname="org.hibernate.tool.instrument.InstrumentTask">
+ <classpath path="${classes.dir}"/>
+ <classpath path="${testclasses.dir}"/>
+ <classpath refid="lib.class.path"/>
+ </taskdef>
+
+ <instrument verbose="true">
+ <fileset dir="${testclasses.dir}/org/hibernate/test">
+ <include name="**/*.class"/>
+ <exclude name="**/*Test$*.class"/>
+ <exclude name="**/*Test.class"/>
+ <exclude name="**/*Tests.class"/>
+ </fileset>
+ </instrument>
+ </target>
+-->
+ <target name="copytest" description="Copy tests to dist dir" if="copy.test" >
+ <copy todir="${dist.test.dir}">
+ <fileset dir="${test.dir}"/>
+ </copy>
+ </target>
+
+ <target name="copysource" depends="copytest" description="Copy sources to dist dir">
+ <copy todir="${dist.src.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="source.files"/>
+ </fileset>
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="jartest" depends="compiletest" description="Build the distribution .jar file">
+ <jar filesetmanifest="merge" jarfile="${jartest.file.name}" basedir="${testclasses.dir}"/>
+ </target>
+</project>
Copied: annotations/patches/JBPAPP-6940/lgpl.txt (from rev 21061, annotations/branches/v3_3_1_GA_CP/lgpl.txt)
===================================================================
--- annotations/patches/JBPAPP-6940/lgpl.txt (rev 0)
+++ annotations/patches/JBPAPP-6940/lgpl.txt 2012-08-30 16:49:40 UTC (rev 21062)
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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 library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
Copied: annotations/patches/JBPAPP-6940/readme.txt (from rev 21061, annotations/branches/v3_3_1_GA_CP/readme.txt)
===================================================================
--- annotations/patches/JBPAPP-6940/readme.txt (rev 0)
+++ annotations/patches/JBPAPP-6940/readme.txt 2012-08-30 16:49:40 UTC (rev 21062)
@@ -0,0 +1,55 @@
+Hibernate Annotations
+==================================================
+Version: 3.3.1.GA.CP04
+
+THIS RELEASE OF HIBERNATE ANNOTATIONS REQUIRES HIBERNATE CORE 3.2.0.GA (and above)
+
+Description
+-----------
+
+The EJB3 specification recognizes the interest and the success of
+the transparent object/relational mapping paradigm. The EJB3 specification
+standardizes the basic APIs and the metadata needed for any object/relational
+persistence mechanism.
+
+Hibernate EntityManager implements the programming interfaces and lifecycle rules
+as defined by the EJB3 persistence specification. Together with Hibernate Annotations
+this wrapper implements a complete (and standalone) EJB3 persistence solution on
+top of the mature Hibernate core. You may use a combination of all three together,
+annotations without EJB3 programming interfaces and lifecycle, or even pure native
+Hibernate, depending on the business and technical needs of your project. You can
+at all times fall back to Hibernate native APIs, or if required, even to native
+JDBC and SQL.
+
+
+Instructions
+------------
+
+Unzip to installation directory, read doc/reference
+
+
+Contact
+------------
+
+Latest Documentation:
+
+ http://hibernate.org
+ http://annotations.hibernate.org
+
+Bug Reports:
+
+ Hibernate JIRA (preferred)
+ hibernate-devel(a)lists.sourceforge.net
+
+Free Technical Support:
+
+ http://forum.hibernate.org
+
+
+Notes
+-----------
+
+If you want to contribute, go to http://www.hibernate.org/
+
+This software and its documentation are distributed under the terms of the
+FSF Lesser Gnu Public License (see lgpl.txt).
12 years, 2 months