oawad79
Apr 3rd, 2008, 10:19 AM
Hello All,
i am new to spring and I would appreciate any help in this?
i have the following spring bean class
public class HouseHoldingDBFacade implements IHouseHoldingDBDacade {
private IUsersDAO usersDao;
public HouseHoldingDBFacade() {
}
public void setUsersDao(IUsersDAO usersDao) {
System.out.println("usersDao null? " + (usersDao == null));
this.usersDao = usersDao;
}
public IUsersDAO getUsersDao() {
return usersDao;
}
public UserBean isValidUserNamePassword(UserBean userBean) {
System.out.println("usersDAO is null? " + (usersDao == null));
return getUsersDao().isValidUserNamePassword(userBean);
}
}
and in applicationContext.xml i have the following
<bean id="derbyHHDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" scope="singleton">
<property name="jndiName" value="java:comp/env/jdbc/hhDb" />
<property name="resourceRef" value="false"/>
</bean>
<!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) -->
<bean id="derbyUsersDataProvider" class="com.springjsf.persistence.dao.derbyimpl.DerbyUsers DAO">
<property name="dataSource">
<ref local="derbyHHDataSource"/>
</property>
</bean>
<bean id="usersDao" class="com.springjsf.persistence.HouseHoldingDBFacade">
<property name="usersDao">
<ref bean="derbyUsersDataProvider"/>
</property>
</bean>
when I deploy the application I get in the first method setUsersDao System.out prints that usersDao != null and when I run the application on the isValidUserNamePassword i get that usersDao = null ? but why???????
i am new to spring and I would appreciate any help in this?
i have the following spring bean class
public class HouseHoldingDBFacade implements IHouseHoldingDBDacade {
private IUsersDAO usersDao;
public HouseHoldingDBFacade() {
}
public void setUsersDao(IUsersDAO usersDao) {
System.out.println("usersDao null? " + (usersDao == null));
this.usersDao = usersDao;
}
public IUsersDAO getUsersDao() {
return usersDao;
}
public UserBean isValidUserNamePassword(UserBean userBean) {
System.out.println("usersDAO is null? " + (usersDao == null));
return getUsersDao().isValidUserNamePassword(userBean);
}
}
and in applicationContext.xml i have the following
<bean id="derbyHHDataSource" class="org.springframework.jndi.JndiObjectFactoryBean" scope="singleton">
<property name="jndiName" value="java:comp/env/jdbc/hhDb" />
<property name="resourceRef" value="false"/>
</bean>
<!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) -->
<bean id="derbyUsersDataProvider" class="com.springjsf.persistence.dao.derbyimpl.DerbyUsers DAO">
<property name="dataSource">
<ref local="derbyHHDataSource"/>
</property>
</bean>
<bean id="usersDao" class="com.springjsf.persistence.HouseHoldingDBFacade">
<property name="usersDao">
<ref bean="derbyUsersDataProvider"/>
</property>
</bean>
when I deploy the application I get in the first method setUsersDao System.out prints that usersDao != null and when I run the application on the isValidUserNamePassword i get that usersDao = null ? but why???????