Issue: retrieving data with JBOSS

I am trying to get the following configured.
Spring, Hibernate, Jboss 5.1, Mysql 5.14

<context:annotation-config />
<context:component-scan base-package="" />
<tx:annotation-driven transaction-manager="transactionManager" />

    class="" />
    class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
    class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

<!-- Most controllers will use the ControllerClassNameHandlerMapping above, 
    but for the index controller we are using ParameterizableViewController, 
    so we must define an explicit mapping for it. -->

<bean id="jspViewResolver"
    p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" />

<!-- the following bean description should be moved to applicationContext. I'm leaving this  decision to Chief. -->
<jee:jndi-lookup id="dataSource" jndi-name="java:/MyDS"/>

<bean id="sessionFactory"
    <property name="dataSource" ref="dataSource"/>
    <property name="configLocation">
    <property name="configurationClass">
<bean id="transactionManager"
    <property name="sessionFactory" ref="sessionFactory" />

hibernate.cfg.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
                                     "  3.0.dtd">
    <property name="hibernate.connection.datasource">java:/MyDS</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
    <property name="hibernate.show_sql">true</property>

    <mapping class=""/>

The data source file “kiche-ds.xml” is:





    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->

The followis is my class that is try to get all users from the DB:

public class UserDAOImpl implements UserDAO{

    SessionFactory sessionFactory;

    public List<User> getUserByLogin() {
            Criteria criteria=sessionFactory.getCurrentSession().createCriteria(User.class);
        List<User> users=criteria.list();
        System.out.println("**** The size of the user is: "+users.size());
            return users;

The strange part is that I am able to get the data form the DB when I use Tomcat(not the one with JBOSS). But when I try to run this application in JBOSS(jb248 pdf), NO data is retrived, there are no errors or exceptions.

Any help will be highly appraciated.


Try to activate the following log appenders:

Then, in the log you can see what data is fetched:

17:08:41,511 DEBUG SQL:92 - 
        stays0_.person as person8_4_0_, as id1_4_0_, as id1_4_1_,
        stays0_.authoriser as authoris2_4_1_,
        stays0_.comments as comments3_4_1_,
        stays0_.endDate as endDate4_4_1_,
        stays0_.oldperson as oldperso7_4_1_,
        stays0_.person as person8_4_1_,
        stays0_.startDate as startDat5_4_1_,
        stays0_.veryoldperson as veryoldp9_4_1_,
        stays0_.vessel as vessel6_4_1_, as id1_2_2_,
        person1_.companyName as companyN2_2_2_,
        person1_.firstName as firstNam3_2_2_,
        person1_.lastName as lastName4_2_2_ 
        Stay stays0_ 
    left outer join
        Person person1_ 
17:08:41,511 TRACE BasicBinder:65 - binding parameter [1] as [INTEGER] - [1]
17:08:41,514 TRACE BasicExtractor:61 - extracted value ([id1_4_1_] : [INTEGER]) - [2]
17:08:41,514 TRACE BasicExtractor:51 - extracted value ([id1_2_2_] : [INTEGER]) - [null]
17:08:41,515 TRACE BasicExtractor:61 - extracted value ([authoris2_4_1_] : [VARCHAR]) - [Blah]
17:08:41,515 TRACE BasicExtractor:61 - extracted value ([comments3_4_1_] : [VARCHAR]) - [Blah]
17:08:41,516 TRACE BasicExtractor:61 - extracted value ([endDate4_4_1_] : [TIMESTAMP]) - [2018-03-21 17:08:41.183]
17:08:41,517 TRACE BasicExtractor:51 - extracted value ([oldperso7_4_1_] : [INTEGER]) - [null]
17:08:41,517 TRACE BasicExtractor:61 - extracted value ([person8_4_1_] : [INTEGER]) - [1]
17:08:41,517 TRACE BasicExtractor:61 - extracted value ([startDat5_4_1_] : [TIMESTAMP]) - [2018-03-21 17:08:41.183]
17:08:41,518 TRACE BasicExtractor:51 - extracted value ([veryoldp9_4_1_] : [INTEGER]) - [null]
17:08:41,518 TRACE BasicExtractor:61 - extracted value ([vessel6_4_1_] : [VARCHAR]) - [A380]
17:08:41,519 TRACE BasicExtractor:61 - extracted value ([person8_4_0_] : [INTEGER]) - [1]
17:08:41,519 TRACE BasicExtractor:61 - extracted value ([id1_4_0_] : [INTEGER]) - [2]

If yiou don’t see that, it means you are connecting to a database schema that has no data.