Package org.hibernate

Examples of org.hibernate.SessionFactory.openSession()


  public List<BOUser> getAllUsers() {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

      Criteria criteria = session.createCriteria(BOUser.class);
      session.flush();
     
      return criteria.list();
View Full Code Here


    SessionFactory sessionFactory = null;
    Session session = null;
    BOUser user = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

      Query query = session.createQuery("from BOUser as user where user.loginName = :username and user_password = MD5(:password)");
      query.setString("username", userName);
      query.setString("password", password);
      List<BOUser> lstUsers = query.list();
View Full Code Here

    }
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

      Criteria criteria = session.createCriteria(BOUser.class);
     
      criteria.add(Restrictions.in("userID", ids));
      return criteria.list();
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;

    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      transaction = session.beginTransaction();

      if (criteria.equalsIgnoreCase("Add") || criteria.equalsIgnoreCase("Update")) {
        session.saveOrUpdate(objToSave);
      } else if (criteria.equalsIgnoreCase("Delete")) {
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;

    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Object mergedObject = session.merge(objToSave);
      return mergedObject;

    } catch (Exception a_th) {
      throw new RuntimeException(a_th);
View Full Code Here

  public List<BOCompany> getAllCompanies(BOUser user) {
    SessionFactory sessionFactory = null;
    Session session = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();

     
     
      if(user.getUserType()==UserType.Administrator)
      {
View Full Code Here

    SessionFactory sessionFactory = null;
    Session session = null;

    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      performDBAction(objToSave, criteria, session);

    } catch (Exception a_th) {
      throw new RuntimeException(a_th);
    } finally {
View Full Code Here

   public Session create(Bean<Session> bean, CreationalContext<Session> arg0)
   {
      try
      {
         SessionFactory sf = getSessionFactory();
         Session session = sf.openSession();
         session = (Session) persistenceProvider.proxyDelegate(session);
         HibernateManagedSessionProxyHandler handler = new HibernateManagedSessionProxyHandler(session, manager, bean.getQualifiers(), persistenceProvider, manager);
         Session proxy = (Session) proxyConstructor.newInstance(handler);
         try
         {
View Full Code Here

  public static List<process> viewRecord(String s[]){ 
   
   
   
    SessionFactory sf=new Configuration().configure().buildSessionFactory();
    Session session=sf.openSession();
   
    Criteria c1=session.createCriteria(process.class);
    // c1.add(Restrictions.and(Restrictions.eq("id", new Integer(0)),Restrictions.like("username","vipul")));
          //      c1.addOrder(Order.desc("id"));
          //      c1.setProjection(Projections.property("username"));
View Full Code Here

    Session session = null;
    SessionFactory sessionFactory = null;
    Transaction transaction = null;
    try {    
      sessionFactory = getConfiguration().buildSessionFactory();
      session = sessionFactory.openSession();
      transaction = session.beginTransaction();
      // TODO: this is not the most efficient loop (opening/closing file)
      for (Iterator iter = queryStrings.iterator(); iter.hasNext();) {
        String query = (String) iter.next();
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.