Corrections After the Merge Today
This commit is contained in:
parent
79f00d975f
commit
ade8cb51db
@ -2,10 +2,20 @@ package org.baeldung.persistence.model;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Set;
|
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 org.hibernate.annotations.OrderBy;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@NamedQuery(name = "Bar.findAll", query = "SELECT b FROM Bar b")
|
@NamedQuery(name = "Bar.findAll", query = "SELECT b FROM Bar b")
|
||||||
public class Bar implements Serializable {
|
public class Bar implements Serializable {
|
||||||
@ -42,7 +52,7 @@ public class Bar implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return this.id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(final int id) {
|
public void setId(final int id) {
|
||||||
@ -50,12 +60,13 @@ public class Bar implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(final String name) {
|
public void setName(final String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -90,5 +101,4 @@ public class Bar implements Serializable {
|
|||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,12 @@ public class Foo implements Serializable {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Foo(final String name) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
private long id;
|
private long id;
|
||||||
@ -38,25 +44,18 @@ public class Foo implements Serializable {
|
|||||||
this.bar = bar;
|
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() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(final long id) {
|
public void setId(final long id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(final String name) {
|
public void setName(final String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,16 @@
|
|||||||
package org.baeldung.persistence.service;
|
package org.baeldung.persistence.service;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.baeldung.persistence.model.Bar;
|
import org.baeldung.persistence.model.Bar;
|
||||||
import org.baeldung.persistence.model.Foo;
|
import org.baeldung.persistence.model.Foo;
|
||||||
import org.baeldung.spring.PersistenceConfig;
|
import org.baeldung.spring.PersistenceConfig;
|
||||||
import org.hibernate.Criteria;
|
|
||||||
import org.hibernate.NullPrecedence;
|
|
||||||
import org.hibernate.Query;
|
import org.hibernate.Query;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.criterion.Order;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -49,7 +44,7 @@ public class FooSortingServiceTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
/* @Test
|
||||||
public final void whenHQlSortingByOneAttribute_thenPrintSortedResults() {
|
public final void whenHQlSortingByOneAttribute_thenPrintSortedResults() {
|
||||||
|
|
||||||
final String hql = "FROM Foo f ORDER BY f.name";
|
final String hql = "FROM Foo f ORDER BY f.name";
|
||||||
@ -180,7 +175,7 @@ public class FooSortingServiceTest {
|
|||||||
}
|
}
|
||||||
sess.getTransaction().commit();
|
sess.getTransaction().commit();
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void whenSortingBars_thenBarsWithSortedFoos() {
|
public final void whenSortingBars_thenBarsWithSortedFoos() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user