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.  [ 1 post ] 
Author Message
 Post subject: Writing HQL for POJOs having annotations over getter method.
PostPosted: Wed Jul 13, 2016 2:51 am 

Joined: Tue Apr 19, 2016 6:24 am
Posts: 5
Hi Guys,

I have been using hibernate since recent time and facing this problem now after porting JPA specific functionality to hibernate.

I have below class:

package hibernate;

import java.util.Collections;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import hibernate.Configlist;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.JoinColumn;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import org.hibernate.annotations.AccessType;
import javax.persistence.OneToOne;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
import javax.persistence.FetchType;
import java.sql.Timestamp;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.envers.Audited;
import javax.persistence.PostLoad;

@Entity(name = "Device")
@Table(name = "Device")
public class Device {

    private List<Configlist> _configlist;

    private java.lang.String _host;

    @OneToMany(cascade = CascadeType.ALL,fetch=FetchType.EAGER)
    @JoinColumn(name = "DEVICE_ID")
    public List<Configlist> getConfiglist() {
        return _configlist;

    public java.lang.String getHost() {
        return _host;

    public Device setHost(java.lang.String value) {
        if (value != null) {
        this._host = value;
        return this;

    private transient long id;

    @GeneratedValue(strategy = GenerationType.AUTO)
    public long getId() {
        return id;

    public void setId(long id) {

Now while writing query for Host, it is throwning InValidSQLStatement saying 'Host' is not found.
could you please let me know how exactly i can write HQL in this case.

Any lead would be helpful

Thank you in advance.


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

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.