1

I am new to Hibernate and need help getting results from a JDNI dataSource. Using JDBC I am able to view connection info like this.

    //jdbc
    conn = DbConnectionFactory.getConnection(ContextType.JNDI_WORKFLOW_DATA);
    log.info("Connnection INFO :" + conn);

Do I have to use the DbConnectionFactory for hibernate in order to view connection Info? I have jndi datasource hibernateProperties in xml file like this.

  <property name="hibernateProperties">
    <props>
        <prop key="hibernate.connection.datasource">java:/env/jdbc/data</prop>

Whenever I try to get the results like this I get a QuerySyntaxException saying ReferenceModel is not mapped. How do I map my RefernceModel?

    //hibernate
    Session session = sessionFactory.openSession();
    List<ReferenceModel> jsonData = (List<ReferenceModel>) session.createQuery("select State, from STATE").list();
spring_hiber
  • 109
  • 1
  • 2
  • 12
  • Your class are declared with uppercase ? try something like "from State" and why you expect a list of ReferenceModel if you're doing a select in a STATE – Ivan Rodrigues Jun 06 '15 at 15:46
  • Thanks Ivan. I found the issue [link](http://stackoverflow.com/questions/24468602/org-hibernate-hibernateexception-createsqlquery-is-not-valid-without-active-tra). – spring_hiber Jun 08 '15 at 12:25

0 Answers0