Results 1 to 2 of 2
  1. #1
    whizzle is offline Member
    Join Date
    Apr 2010
    Rep Power

    Default Hibernate Setting Up Issues

    When I try to run a simple HQL select statement I get the following error.

    Java Code:
    Thread [main] (Suspended (exception SQLGrammarException))	
    	QueryImpl.list() line: 80	
    	Main.main(String[]) line: 20
    Here's my code
    PHP Code:
    import java.util.List;
    import org.hibernate.Query;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    public class Main
    	public static void main(String[] args)
    		SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
    		Session session = sessionFactory.openSession();
    	 	System.out.println("Session Openned");
    	 	String hqlQuery = "from Person p";
    	 	Query query = session.createQuery(hqlQuery);
    	 	List<Object> list = query.list();
    And here's my cfg.xml file
    XML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-configuration PUBLIC
    		"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="hibernate.connection.url">jdbc:mysql://localhost/hibernatepersons</property>
            <property name="hibernate.connection.username">root</property>
            <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
            <!-- Mapping files -->
    		<mapping resource="Address.hbm.xml"/>
    		<mapping resource="Person.hbm.xml"/>
    		<mapping resource="PersonAddress.hbm.xml"/>
    		<mapping resource="User.hbm.xml"/>
    Any ideas???

  2. #2
    whizzle is offline Member
    Join Date
    Apr 2010
    Rep Power

Similar Threads

  1. jdk issues
    By artemff in forum New To Java
    Replies: 3
    Last Post: 01-02-2010, 04:18 AM
  2. Issues with Jva I.O
    By Annatar01 in forum New To Java
    Replies: 0
    Last Post: 02-08-2008, 02:16 AM
  3. jcheckbox issues need help. thanks.
    By carlos123 in forum New To Java
    Replies: 3
    Last Post: 11-05-2007, 11:37 PM
  4. Replies: 2
    Last Post: 06-30-2007, 04:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts