Examples of openSession()


Examples of org.hibernate.SessionFactory.openSession()

    }
    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

Examples of org.hibernate.SessionFactory.openSession()

    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

Examples of org.hibernate.SessionFactory.openSession()

    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

Examples of org.hibernate.SessionFactory.openSession()

  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

Examples of org.hibernate.SessionFactory.openSession()

    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

Examples of org.hibernate.SessionFactory.openSession()

   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

Examples of org.hibernate.SessionFactory.openSession()

  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

Examples of org.hibernate.SessionFactory.openSession()

    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

Examples of org.hibernate.SessionFactory.openSession()

    jbButton.setText("mirek");
    jbButton.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
        Stanowisko s = (Stanowisko) sessionFactory.openSession().load(
            Stanowisko.class, 1);
        System.out.println(s.getNazwa());

      }
    });
View Full Code Here

Examples of org.hibernate.SessionFactory.openSession()

        // check if we can look up the Hibernate session factory that should of been bound because of
        // the hibernate.session_factory_name was specified in the properties (in peristence.xml above).
        SessionFactory hibernateSessionFactory = rawLookup("modelSessionFactory",SessionFactory.class);
        assertNotNull("jndi lookup of hibernate.session_factory_name should return HibernateSessionFactory", hibernateSessionFactory);

        Session session = hibernateSessionFactory.openSession();
        Employee emp = (Employee)session.get(Employee.class,1);
        assertTrue("name read from hibernate session is Sally", "Sally".equals(emp.getName()));
    }

    // Test that an extended Persistence context can be injected into a Hibernate Session
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.