com.leapfrog.studentenroll.dao.impl.StudentDAOImpl.java Source code

Java tutorial

Introduction

Here is the source code for com.leapfrog.studentenroll.dao.impl.StudentDAOImpl.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.leapfrog.studentenroll.dao.impl;

import com.leapfrog.studentenroll.dao.StudentDAO;
import com.leapfrog.studentenroll.entity.Student;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 *
 * @author Admin
 */
@Repository
public class StudentDAOImpl implements StudentDAO {

    @Autowired
    private SessionFactory SessionFactory;
    private Session session;

    @Override
    public Student getByStudentId(int studentId) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public List<Student> getAll() {
        session = SessionFactory.getCurrentSession();
        session.getTransaction().begin();
        List<Student> studentList = session.createQuery("SELECT s from Student s").list();
        session.getTransaction().commit();
        return studentList;
    }

    @Override
    public int insert(Student t) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public int update(Student t) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public int delete(int id) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

}