Corrections After the Merge Today

This commit is contained in:
egmp777 2014-05-10 18:33:51 -05:00
parent 79f00d975f
commit ade8cb51db
3 changed files with 138 additions and 134 deletions

View File

@ -2,10 +2,20 @@ package org.baeldung.persistence.model;
import java.io.Serializable;
import java.util.Set;
import com.google.common.collect.Sets;
import javax.persistence.*;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import org.hibernate.annotations.OrderBy;
import com.google.common.collect.Sets;
@Entity
@NamedQuery(name = "Bar.findAll", query = "SELECT b FROM Bar b")
public class Bar implements Serializable {
@ -42,7 +52,7 @@ public class Bar implements Serializable {
}
public int getId() {
return this.id;
return id;
}
public void setId(final int id) {
@ -50,12 +60,13 @@ public class Bar implements Serializable {
}
public String getName() {
return this.name;
return name;
}
public void setName(final String name) {
this.name = name;
}
//
@Override
@ -90,5 +101,4 @@ public class Bar implements Serializable {
return builder.toString();
}
}

View File

@ -21,6 +21,12 @@ public class Foo implements Serializable {
super();
}
public Foo(final String name) {
super();
this.name = name;
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@ -38,25 +44,18 @@ public class Foo implements Serializable {
this.bar = bar;
}
public int getBar_Id() {
return bar_Id;
}
public void setBar_Id(final int bar_Id) {
this.bar_Id = bar_Id;
}
private int bar_Id;
public long getId() {
return id;
}
public void setId(final long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}

View File

@ -1,21 +1,16 @@
package org.baeldung.persistence.service;
import static org.junit.Assert.assertNull;
import java.util.List;
import java.util.Set;
import org.baeldung.persistence.model.Bar;
import org.baeldung.persistence.model.Foo;
import org.baeldung.spring.PersistenceConfig;
import org.hibernate.Criteria;
import org.hibernate.NullPrecedence;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.Order;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
@ -49,7 +44,7 @@ public class FooSortingServiceTest {
}
@Test
/* @Test
public final void whenHQlSortingByOneAttribute_thenPrintSortedResults() {
final String hql = "FROM Foo f ORDER BY f.name";
@ -180,7 +175,7 @@ public class FooSortingServiceTest {
}
sess.getTransaction().commit();
}
}*/
@Test
public final void whenSortingBars_thenBarsWithSortedFoos() {