Skip to main content
deleted 1 character in body; edited title
Source Link
Fiyaz Hasan
  • 53.6k
  • 70
  • 267
  • 398

equivalence Equivalence of from dual in postgreSQLPostgreSQL

I work with hibernateHibernate and oracle

Oracle. I used this code :

     if (null != sessionFactory) {
                Session s = currentSession.get();
    
                if ((null == s) || !s.isOpen()) {
                    s = sessionFactory.openSession();
                    currentSession.set(s);
                } else {
                    try {
                        HibernateWork hibernateWork = new HibernateWork("SELECT 1 FROM DUAL");
                        s.doWork(hibernateWork);
                    } catch (Exception e) {
                       
                        s = sessionFactory.openSession();
                        currentSession.set(s);
                    }
                }
    
                return s;
            }

I want to do the same thing with postgreSQL

PostgreSQL, but PostgreSQL does NOT support the ‘FROM dual’ syntax

 . I want to know equivalence of dual in postgreSQLPostgreSQL.

equivalence of from dual in postgreSQL

I work with hibernate and oracle

I used this code :

 if (null != sessionFactory) {
            Session s = currentSession.get();

            if ((null == s) || !s.isOpen()) {
                s = sessionFactory.openSession();
                currentSession.set(s);
            } else {
                try {
                    HibernateWork hibernateWork = new HibernateWork("SELECT 1 FROM DUAL");
                    s.doWork(hibernateWork);
                } catch (Exception e) {
                   
                    s = sessionFactory.openSession();
                    currentSession.set(s);
                }
            }

            return s;
        }

I want to do the same thing with postgreSQL

but PostgreSQL does NOT support the ‘FROM dual’ syntax

  I want to know equivalence of dual in postgreSQL

Equivalence of from dual in PostgreSQL

I work with Hibernate and Oracle. I used this code :

     if (null != sessionFactory) {
                Session s = currentSession.get();
    
                if ((null == s) || !s.isOpen()) {
                    s = sessionFactory.openSession();
                    currentSession.set(s);
                } else {
                    try {
                        HibernateWork hibernateWork = new HibernateWork("SELECT 1 FROM DUAL");
                        s.doWork(hibernateWork);
                    } catch (Exception e) {
                       
                        s = sessionFactory.openSession();
                        currentSession.set(s);
                    }
                }
    
                return s;
            }

I want to do the same thing with PostgreSQL, but PostgreSQL does NOT support the ‘FROM dual’ syntax. I want to know equivalence of dual in PostgreSQL.

Source Link
franco
  • 2.1k
  • 9
  • 45
  • 80

equivalence of from dual in postgreSQL

I work with hibernate and oracle

I used this code :

 if (null != sessionFactory) {
            Session s = currentSession.get();

            if ((null == s) || !s.isOpen()) {
                s = sessionFactory.openSession();
                currentSession.set(s);
            } else {
                try {
                    HibernateWork hibernateWork = new HibernateWork("SELECT 1 FROM DUAL");
                    s.doWork(hibernateWork);
                } catch (Exception e) {
                   
                    s = sessionFactory.openSession();
                    currentSession.set(s);
                }
            }

            return s;
        }

I want to do the same thing with postgreSQL

but PostgreSQL does NOT support the ‘FROM dual’ syntax

I want to know equivalence of dual in postgreSQL