开发者

Hibernate Exception

I am trying to load some info from the database asynchronously.

I have a class A that has a relation One to One with ClassB.

What I do, is getting count of class A in the database then load limited number of class A

So Hibernate runs 3 queries: first to get cou开发者_运维问答nt, second to get class A, third to load class B, mapped in class A.

I am running it asynch using a Timer like this:

    Timer timer = new Timer(true);
    // add the task to the timer
    timer.schedule(task, 1);

the task.run calls the loading method

If I am not using the timer, test works ok. If I am using it, Hibernate throws a TableNotFound Exception for the third query

any idea, what's the problem?


Is your timer using the same SessionFactory? Your SessionFactory may not be configured with your hibernate.cfg.xml information.


Thanks for ur replies.

After checking stack trace, I found hibernate mapping was having a problem with some class, the class has @IndexColumn with name "order" which is a keyword on SQL, that prevents table creation.

I don't know why it works w/out timer, and error discovered w/ timer.

After renaming the IndexColumn, test works ok

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜