-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: QueryException while requesting field of AuditInfo in HQL
PostPosted: Thu Mar 18, 2010 11:26 am 
Newbie

Joined: Mon Jul 20, 2009 5:09 pm
Posts: 16
Hello everybody,

I have implemented audit logging as descripted here:
https://www.hibernate.org/48.html

I want to get all entries after a specfic date, so I need to execute the following query

Code:
from User o
where o.auditInfo.lastUpdated  >= '2010-03-15 00:00:00.0'


But I always get the exception
org.hibernate.QueryException: could not resolve property: lastUpdated of:

I mapped it as follows.

Code:
    @Type(type = "com.xxx.audit.AuditInfoType")
    @Columns(columns =
        {
                @Column(name = "lastUpdated", nullable = false),
                @Column(name = "created", nullable = false) })
    public AuditInfo getAuditInfo() {
        return this.auditInfo;
    }
    public void setAuditInfo(AuditInfo auditInfo) {
        this.auditInfo = auditInfo;
    }


I also tried To map AuditInfo with @Embedded. Nothing works. Where is my error?

If I fetch an embedded id in this way everything works. Why not with the UserType?

Can somebody please help me?!

Thanks,
Till

Edit:
Code:
select o.auditInfo from User o
works fine


Top
 Profile  
 
 Post subject: Re: QueryException while requesting field of AuditInfo in HQL
PostPosted: Tue Mar 23, 2010 7:03 am 
Newbie

Joined: Mon Jul 20, 2009 5:09 pm
Posts: 16
Can nobody help me?

I can't imagine that there should not be a solution.

Thanks in advance for help.


Top
 Profile  
 
 Post subject: Re: QueryException while requesting field of AuditInfo in HQL
PostPosted: Tue Mar 23, 2010 11:06 am 
Newbie

Joined: Mon Jul 20, 2009 5:09 pm
Posts: 16
And the answer is:

Mark the UserType as @Embeddable and place @Embedded in the bean.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.