views:

26

answers:

0

i am facing these exception:

1515 [main] WARN org.hibernate.util.JDBCExceptionReporter  - SQL Error: -1, SQLState: XJ040
1515 [main] ERROR org.hibernate.util.JDBCExceptionReporter  - DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'myeclipse', see the next exception for details.

 java.sql.SQLException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'myeclipse', see the next exception for details.

Caused by: org.apache.derby.client.am.SqlException: DERBY SQL error: SQLCODE: -1, SQLSTATE: XJ040, SQLERRMC: Failed to start database 'myeclipse', see the next exception for details.

at this line: transaction = session.beginTransaction();

Here is Main method:

public static void main(String[] args) {
    BasicConfigurator.configure();
    Session session = HibernateUtil.getSessionFactory().openSession();
    Transaction transaction = null;
    try {
        transaction = session.beginTransaction();
        Label label = new Label("vijay");
        Query query=session.createQuery("from vij");
        List list=query.list();
            for (Iterator it=list.iterator();it.hasNext();)
        {
            System.out.println(label.getId());          
        }
            transaction.commit();

    } catch (HibernateException e) {

        if (transaction != null) {
              transaction.rollback();
                        }
                    e.printStackTrace();
    } finally {
        session.close();
    }

}