Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO][Hibernate] org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped [from MyMode
[CDO][Hibernate] org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped [from MyMode [message #837929] Fri, 06 April 2012 09:56 Go to next message
Kris Missing name is currently offline Kris Missing nameFriend
Messages: 47
Registered: July 2009
Member
Hi,

when I run my CDO client against the CDO server the first time and start
with an hibernate query, I get the following exception (see below). When
I start the DB Access with an operation that persists the a model
instance, the exception is not fired. It is also not fired any more when
query operations are executed after the persisting operation.

So my impression is, that the first persisting operation seems to
initialize the hibernate mapping implicitly. Is there a way to trigger
this explicitly and then start with queries as first db operation? The
purpose is to check if the db has some default values (query first) and
if not, create them as db content initialization.

Thanks & Regards
Kris


org.eclipse.net4j.signal.RemoteException:
org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped
[from MyModelClass]
at
org.eclipse.net4j.signal.RequestWithConfirmation.getRemoteException(RequestWithConfirmation.java:139)
at
org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:128)
at
org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:446)
at
org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:63)
at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is
not mapped [from MyModelClass]
at
org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
at
org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111)
at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
at
org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:322)
at
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441)
at
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325)
at
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733)
at
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584)
at
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
at
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
at
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
at
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
at
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
at
org.eclipse.emf.cdo.server.internal.hibernate.HibernateQueryHandler.executeQuery(HibernateQueryHandler.java:71)
at
org.eclipse.emf.cdo.internal.server.QueryManager$QueryContext.run(QueryManager.java:293)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
... 3 more
Re: [CDO][Hibernate] org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped [from My [message #839484 is a reply to message #837929] Sun, 08 April 2012 20:06 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi KW,
I tested this on a mysql database and with me it went fine. So restarting the cdo server and doing a client query
(without first updating/inserting) went fine without this error. I see that the domain model gets read from the database
when the app starts. I used the org.eclipse.emf.cdo.examples.hibernate.server example project.

I can reproduce this error when I use an in-memory database which starts empty every time when I restart the server, but
that's logical. With an empty database you first need to tell the server which epackages are to be persisted.

Let me know if your situation is different.

gr. Martin

On 04/06/2012 11:56 AM, KW wrote:
> Hi,
>
> when I run my CDO client against the CDO server the first time and start with an hibernate query, I get the following
> exception (see below). When I start the DB Access with an operation that persists the a model instance, the exception is
> not fired. It is also not fired any more when query operations are executed after the persisting operation.
>
> So my impression is, that the first persisting operation seems to initialize the hibernate mapping implicitly. Is there
> a way to trigger this explicitly and then start with queries as first db operation? The purpose is to check if the db
> has some default values (query first) and if not, create them as db content initialization.
>
> Thanks & Regards
> Kris
>
>
> org.eclipse.net4j.signal.RemoteException: org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped [from
> MyModelClass]
> at org.eclipse.net4j.signal.RequestWithConfirmation.getRemoteException(RequestWithConfirmation.java:139)
> at org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:128)
> at org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:446)
> at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:63)
> at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:680)
> Caused by: org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped [from MyModelClass]
> at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
> at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111)
> at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
> at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:322)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
> at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
> at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
> at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
> at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
> at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
> at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
> at org.eclipse.emf.cdo.server.internal.hibernate.HibernateQueryHandler.executeQuery(HibernateQueryHandler.java:71)
> at org.eclipse.emf.cdo.internal.server.QueryManager$QueryContext.run(QueryManager.java:293)
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> ... 3 more


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [CDO][Hibernate] org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped [from My [message #845997 is a reply to message #839484] Sun, 15 April 2012 16:49 Go to previous message
Kris Missing name is currently offline Kris Missing nameFriend
Messages: 47
Registered: July 2009
Member
Hi Martin,

[sorry for the late response - i was on holiday last week]

The setup is a little different. The database I am using is hsqldb. It
is used in server mode, so the data gets really persisted and not just
in memory. Indeed the db is empty (no db schema also) when my app first
accessed the database.

However, when the first db operation of the app is a persisting
operation, apparantly some "magic" is triggered that creates the db
schema before persisting the the objects. When the first operation is a
query operation this magic is left out and results in the "not mapped"
error.

For now I am just using the simple workaround by creating a dummy entry
in db as the very first db operation that is removed later on.

Thanks & Regards
Kris


Am 4/8/12 10:06 PM, schrieb Martin Taal:
> Hi KW,
> I tested this on a mysql database and with me it went fine. So
> restarting the cdo server and doing a client query (without first
> updating/inserting) went fine without this error. I see that the domain
> model gets read from the database when the app starts. I used the
> org.eclipse.emf.cdo.examples.hibernate.server example project.
>
> I can reproduce this error when I use an in-memory database which starts
> empty every time when I restart the server, but that's logical. With an
> empty database you first need to tell the server which epackages are to
> be persisted.
>
> Let me know if your situation is different.
>
> gr. Martin
>
> On 04/06/2012 11:56 AM, KW wrote:
>> Hi,
>>
>> when I run my CDO client against the CDO server the first time and
>> start with an hibernate query, I get the following
>> exception (see below). When I start the DB Access with an operation
>> that persists the a model instance, the exception is
>> not fired. It is also not fired any more when query operations are
>> executed after the persisting operation.
>>
>> So my impression is, that the first persisting operation seems to
>> initialize the hibernate mapping implicitly. Is there
>> a way to trigger this explicitly and then start with queries as first
>> db operation? The purpose is to check if the db
>> has some default values (query first) and if not, create them as db
>> content initialization.
>>
>> Thanks & Regards
>> Kris
>>
>>
>> org.eclipse.net4j.signal.RemoteException:
>> org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is not mapped
>> [from
>> MyModelClass]
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.getRemoteException(RequestWithConfirmation.java:139)
>>
>> at
>> org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:128)
>>
>> at
>> org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:446)
>>
>> at
>> org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:63)
>>
>> at
>> org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
>> at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
>> at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
>> at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
>> at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>
>> at java.lang.Thread.run(Thread.java:680)
>> Caused by: org.hibernate.hql.ast.QuerySyntaxException: MyModelClass is
>> not mapped [from MyModelClass]
>> at
>> org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:180)
>>
>> at
>> org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:111)
>>
>> at
>> org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
>> at
>> org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:322)
>>
>> at
>> org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3441)
>>
>> at
>> org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325)
>>
>> at
>> org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733)
>>
>> at
>> org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584)
>> at
>> org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
>>
>> at
>> org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
>>
>> at
>> org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
>>
>> at
>> org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
>>
>> at
>> org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
>>
>> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
>> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
>> at
>> org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
>>
>> at
>> org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
>>
>> at
>> org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
>>
>> at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
>> at
>> org.eclipse.emf.cdo.server.internal.hibernate.HibernateQueryHandler.executeQuery(HibernateQueryHandler.java:71)
>>
>> at
>> org.eclipse.emf.cdo.internal.server.QueryManager$QueryContext.run(QueryManager.java:293)
>>
>> at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
>> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>> ... 3 more
>
>
Previous Topic:Saving model instance to XML with XSD?
Next Topic:[CDO][Net4j] Revision loading performance, compareRevisions
Goto Forum:
  


Current Time: Thu Apr 25 00:21:15 GMT 2024

Powered by FUDForum. Page generated in 0.02458 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top