Skip to content

Commit

Permalink
HHH-7917 : Add support for ordered sets
Browse files Browse the repository at this point in the history
  • Loading branch information
gbadner committed Jan 10, 2013
1 parent bf5fabd commit 413ca60
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 22 deletions.
Expand Up @@ -475,7 +475,9 @@ Type resolvePluralType(
pluralAttributeBinding.getComparator()
);
}
// TODO: else if ( pluralAttributeBinding.hasOrder() ) { orderedSet... }
else if ( pluralAttributeBinding.getOrderBy() != null ) {
return typeFactory().orderedSet( role, propertyRef );
}
else {
return typeFactory().set( role, propertyRef );
}
Expand Down
Expand Up @@ -34,7 +34,6 @@
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;

@FailureExpectedWithNewMetamodel
public class OrderByTest extends BaseCoreFunctionalTestCase {
@Test
public void testOrderByName() throws Exception {
Expand All @@ -47,17 +46,14 @@ public void testOrderByName() throws Exception {
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);
Expand Down
Expand Up @@ -4,6 +4,7 @@
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

@SuppressWarnings({"unchecked", "serial"})
Expand Down
@@ -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() {

Expand All @@ -19,15 +16,4 @@ public String getName() {
public void setName(String name) {
this.name = name;
}

@Id
@GeneratedValue
public int getId() {
return id;
}

public void setId(int id) {
this.id = id;
}

}
Expand Up @@ -49,7 +49,6 @@ public String[] getMappings() {

@Test
@SuppressWarnings( {"unchecked"})
@FailureExpectedWithNewMetamodel
public void testOrderBy() {
Search s = new Search("Hibernate");
s.getSearchResults().add("jboss.com");
Expand Down

0 comments on commit 413ca60

Please sign in to comment.