开发者

GWT + Hibernate + HSQLDB

Hi I made a quick implementation of this:

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

I 开发者_JS百科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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜