one to one initial work

This commit is contained in:
eugenp 2013-05-18 16:55:10 +03:00
parent 780300b8b3
commit 1a8b39bde6
10 changed files with 130 additions and 3 deletions

View File

@ -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> {
//
}

View File

@ -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> {

View File

@ -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> {
//
}

View File

@ -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;

View File

@ -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;

View File

@ -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
}

View File

@ -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;

View File

@ -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
}

View File

@ -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;
}
}

View File

@ -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;
}
}