-->
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: Hibernate doesn't seem to connect to sql server 2005
PostPosted: Mon Nov 15, 2010 2:23 pm 
Newbie

Joined: Mon Nov 15, 2010 2:19 pm
Posts: 1
Not sure what else to try..I can't seem to get Hibernate to return a list..
List always comes back empty..


Code:
       Session session =sessionFactory.openSession();
       Transaction tx = session.beginTransaction();
       List result = session.createQuery( "from Sample" ).list();

      for ( Sample s: (List<Sample>) result ) {
           System.out.println( "Event (" + s.getDescr() + ") : " + s.getLogoUri() );
       }

       tx.commit();
       session.close();
       
       System.err.println(" LIST:::" + result);



In my tomcat logs all I see is ...

Code:

Hibernate:
    select
        sample0_.type_id as type1_0_,
        sample0_.logo_uri as logo2_0_,
        sample0_.descr as descr0_
    from
        tbl_sample sample0_
LIST:::[]






My hbm.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.foodsvc.orm.bo" >

     <class name="Sample" table="tbl_sample" >
          <id column="type_id" name="id" type="java.lang.Long">
                <generator class="increment"/>
        </id>
          <property column="logo_uri" name="logoUri" type="java.lang.String"/>
      <property column="descr" name="descr" type="java.lang.String"/>
   </class>
   <query name="all.sample">from Sample</query>
</hibernate-mapping




Any help is greatly appreciated...


Top
 Profile  
 
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.