quarks
quarks

Reputation: 35346

GWT + Hibernate + HSQLDB

Hi I made a quick implementation of this:

http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html

I created a simple login implementation of it. I created a simple login page and login button to trigger the service.

Inside the LoginServiceImpl.java:

@Override
public void createAccount(Account user) {
    try {
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        session.save(user);
        session.getTransaction().commit();
    }catch (HibernateException e) {
        e.printStackTrace();
    }catch (InvocationException e) {
        e.printStackTrace();

    }
}

However, i get this console output (truncated):

1110 [btpool0-0] INFO org.hibernate.tool.hbm2ddl.SchemaExport - schema export complete
Hibernate: insert into ACCOUNT (ACCOUNT_ID, name, password) values (null, ?, ?)
Hibernate: call identity(

)

Before I started the GWT app from eclipse, I run this command:

java -cp hsqldb.jar org.hsqldb.Server

And from the HSQLDB console (when the service is invoked):

[Server@691f36]: A pre-9.0 client attempted to connect.  We rejected them.

Is there a fix for this or I should use a different DB?

Thanks.

Upvotes: 0

Views: 982

Answers (2)

fredt
fredt

Reputation: 24372

The problem is this: You have got HSQLDB 2.0.0 on your classpath when you run

java -cp hsqldb.jar org.hsqldb.Server

But in Eclipse, a copy of HSQLDB 1.8 is being used. When Eclipse attempts to connect to the HSQLDB server, it uses this 1.8 jar, then the server complains that an older version is trying to connect.

If you just want to experiment, use the HSQLDB 1.8 jar (smaller jar about 700 K) to run the server.

Upvotes: 1

raj
raj

Reputation: 1

how you are configured Hibenrate. If you use Hibernate.cfg.xml file then make sure that u have specified, right dialect. Even with HSQLDB also should work.

Upvotes: 0

Related Questions