Hibernate console returns nulls

Hello, now I'm facing such problem: executing HQL queryis ("FROM Entity") in Hibernate consle return nulls. When specifiying fields ("SELECT id FROM Entity") – works correct. Please see folowing screenshots:
Screen Shot 2014-03-06 at 18.16.28.png
Screen Shot 2014-03-06 at 18.17.24.png

Same story with JPA console.

What can be the reason and how to fix it?


Comment actions Permalink


I have checked my test entities briefly, and they have no such problem.

Are you sure this is IDEA problem, not Hibernate itself? Do you have some application code using the same Hibernate entity: what does it return with such queries?


Comment actions Permalink

With folowing code:

public class Runner {

    public static void main(String[] args) {

        Session s = PersistenceFactory.getSession();

        Iterator<ReasonCode> codes = s.createQuery("FROM ReasonCode").iterate();

        while (codes.hasNext()) System.out.println(codes.next());



everything working fine:

ReasonCode [code=Общее, description=Общее]

ReasonCode [code=01, description=Некондиция]

ReasonCode [code=Склад, description=Склад]

ReasonCode [code=01, description=Склад]

ReasonCode [code=01, description=Некондиция]

ReasonCode [code=05, description=Утилизация]

ReasonCode [code=09, description=Стандарт]

ReasonCode [code=02, description=Холд]

ReasonCode [code=Стандарт, description=Разблокировка]

ReasonCode [code=Стандарт, description=Стандарт]

ReasonCode [code=79, description=Просрочен]

ReasonCode [code=07, description=Брак]

I also noticed that in result table from hql console presents few columns with names started with CGLIB* (assuming this is kind of internal hibernate stuff).

No matter is datasource from IDE is attached to persistence unit or configuration is provided by persistence.xml in cp – result stays the same.

Here is my persistence.xml (if it make any sence):
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    <persistence-unit name="wms">
        <!--suppress JpaDomInspection -->
            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
            <property name="hibernate.connection.driver_class" value="net.sourceforge.jtds.jdbc.Driver"/>
            <property name="hibernate.connection.username" value="sa"/>
            <property name="hibernate.connection.password" value="admin0"/>
            <property name="hibernate.connection.url" value="jdbc:jtds:sqlserver://dev-db.local:1433/iswms"/>
            <property name="hibernate.show_sql" value="false"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="use_sql_comments" value="true"/>


Thanks a lot.
Comment actions Permalink

Thank you.

I have imitated similar table in MS SQL with JTDS and it is Ok for me.

Can you show the table definition (DDL/SQL)? I suspect IDEA can't process some data type.

BTW, what server version is it?


Comment actions Permalink

Server is 2012 (11.0.2100.60) running on Windows 8.1

DDL of table ReasonCode:

CREATE TABLE reason_code



    code VARCHAR(20) NOT NULL,

    lang VARCHAR(10) NOT NULL,

    description VARCHAR(50) NOT NULL,

    require_comments_flag TINYINT NOT NULL,

    type VARCHAR(15) NOT NULL,

    use_in_receiving TINYINT NOT NULL,

    show_in_movement TINYINT NOT NULL,

    use_in_inv_ctrl TINYINT NOT NULL,

    use_in_gui TINYINT NOT NULL,

    auto_delete TINYINT NOT NULL,

    category VARCHAR(15)


public class ReasonCode extends DefaultCRUDLifeCycle<ReasonCode> implements Identifiable,Serializable{

 private Long id;

@Column( name = "code" , length=20,nullable=false)
 private String code;

@Column(name = "lang", length = 10, nullable = false)
 private String lang;

@Column( name = "description" , length=50, nullable=false)
 private String description;

 @Column( name = "require_comments_flag" , nullable=false)
 private boolean requireComments;

 @Column( name = "type" , length=15, nullable=false)
 private String type;

 @Column( name = "use_in_receiving" , nullable=false)
 private boolean useInReceiving;

 @Column( name = "show_in_movement" , nullable=false)
 private boolean showInMovement;

 @Column( name = "use_in_inv_ctrl" , nullable=false)
 private boolean useInInvCtrl;

 @Column( name = "use_in_gui" , nullable=false)
 private boolean useInGUI;

@Column( name = "auto_delete" , nullable=false)
 private boolean autoDelete;

 @Column( name = "category" , length=15, nullable=true)
 private String category;

 @JoinTable(name = "reason_code_sku_group_xref")
 private List<SKUGroup> skuGroups;

//Getters and setters omitted


Thanks a lot.
Comment actions Permalink

Thanks a lot for the data.

I have recreated this structure with our test MS SQL 2005 and 2008, but failed to reproduce the problem. It may be 2012-specific, but we do not have it right now, I need more time to set up the server.

If you don't want to wait, you can create an issue in our bugtracker: http://youtrack.jetbrains.com/issues/IDEA

BTW, what version of JTDS driver are you using?


Comment actions Permalink

Database: Microsoft SQL Server/11.00.2100
Driver name: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase
Driver version: 1.2.5
JDBC version: 3.0
Case sensitivity: MIXED (quoted: MIXED)


Please sign in to leave a comment.