HHH-7917 : Add support for ordered sets

This commit is contained in:
Gail Badner 2013-01-10 14:42:12 -08:00
parent bf5fabd64a
commit 413ca60475
5 changed files with 6 additions and 22 deletions

View File

@ -475,7 +475,9 @@ class HibernateTypeHelper {
pluralAttributeBinding.getComparator()
);
}
// TODO: else if ( pluralAttributeBinding.hasOrder() ) { orderedSet... }
else if ( pluralAttributeBinding.getOrderBy() != null ) {
return typeFactory().orderedSet( role, propertyRef );
}
else {
return typeFactory().set( role, propertyRef );
}

View File

@ -34,7 +34,6 @@ import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@FailureExpectedWithNewMetamodel
public class OrderByTest extends BaseCoreFunctionalTestCase {
@Test
public void testOrderByName() throws Exception {
@ -47,17 +46,14 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
Widgets widget = new Widgets();
widget.setName("hammer");
set.add(widget);
s.persist(widget);
widget = new Widgets();
widget.setName("axel");
set.add(widget);
s.persist(widget);
widget = new Widgets();
widget.setName("screwdriver");
set.add(widget);
s.persist(widget);
p.setWidgets(set);
s.persist(p);

View File

@ -4,6 +4,7 @@ import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
@SuppressWarnings({"unchecked", "serial"})

View File

@ -1,12 +1,9 @@
package org.hibernate.test.annotations.collectionelement;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Embeddable;
@Entity
@Embeddable
public class Widgets {
private String name;
private int id;
public Widgets() {
@ -19,15 +16,4 @@ public class Widgets {
public void setName(String name) {
this.name = name;
}
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View File

@ -49,7 +49,6 @@ public class OrderByTest extends BaseCoreFunctionalTestCase {
@Test
@SuppressWarnings( {"unchecked"})
@FailureExpectedWithNewMetamodel
public void testOrderBy() {
Search s = new Search("Hibernate");
s.getSearchResults().add("jboss.com");