one to one initial work
This commit is contained in:
parent
780300b8b3
commit
1a8b39bde6
|
@ -0,0 +1,8 @@
|
|||
package org.baeldung.spring.persistence.dao;
|
||||
|
||||
import org.baeldung.spring.persistence.dao.common.IOperations;
|
||||
import org.baeldung.spring.persistence.model.Child;
|
||||
|
||||
public interface IChildDao extends IOperations<Child> {
|
||||
//
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package org.baeldung.spring.persistence.dao;
|
||||
|
||||
import org.baeldung.spring.persistence.dao.common.IOperations;
|
||||
import org.baeldung.spring.persistence.model.Foo;
|
||||
|
||||
public interface IFooDao extends IOperations<Foo> {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package org.baeldung.spring.persistence.dao;
|
||||
|
||||
import org.baeldung.spring.persistence.dao.common.IOperations;
|
||||
import org.baeldung.spring.persistence.model.Owner;
|
||||
|
||||
public interface IOwnerDao extends IOperations<Owner> {
|
||||
//
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.spring.persistence.dao;
|
||||
package org.baeldung.spring.persistence.dao.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.spring.persistence.dao;
|
||||
package org.baeldung.spring.persistence.dao.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
|
@ -0,0 +1,24 @@
|
|||
package org.baeldung.spring.persistence.dao.impl;
|
||||
|
||||
import org.baeldung.spring.persistence.dao.IChildDao;
|
||||
import org.baeldung.spring.persistence.dao.common.AbstractHibernateDao;
|
||||
import org.baeldung.spring.persistence.model.Child;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class ChildDao extends AbstractHibernateDao<Child> implements IChildDao {
|
||||
|
||||
@Autowired
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
public ChildDao() {
|
||||
super();
|
||||
|
||||
setClazz(Child.class);
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package org.baeldung.spring.persistence.dao;
|
||||
package org.baeldung.spring.persistence.dao.impl;
|
||||
|
||||
import org.baeldung.spring.persistence.dao.IFooDao;
|
||||
import org.baeldung.spring.persistence.dao.common.AbstractHibernateDao;
|
||||
import org.baeldung.spring.persistence.model.Foo;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -0,0 +1,24 @@
|
|||
package org.baeldung.spring.persistence.dao.impl;
|
||||
|
||||
import org.baeldung.spring.persistence.dao.IOwnerDao;
|
||||
import org.baeldung.spring.persistence.dao.common.AbstractHibernateDao;
|
||||
import org.baeldung.spring.persistence.model.Owner;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class OwnerDao extends AbstractHibernateDao<Owner> implements IOwnerDao {
|
||||
|
||||
@Autowired
|
||||
private SessionFactory sessionFactory;
|
||||
|
||||
public OwnerDao() {
|
||||
super();
|
||||
|
||||
setClazz(Owner.class);
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.baeldung.spring.persistence.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Child implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private long id;
|
||||
|
||||
public Child() {
|
||||
super();
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.baeldung.spring.persistence.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class Owner implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private long id;
|
||||
|
||||
public Owner() {
|
||||
super();
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(final long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue