- Where does UpdateAReservationAction get its reservationDao from?
Code:
It gets the Dao from:
ReservationDao reservationDao = SpringDaoFactory.getReservationDao();
Where SpringDaoFactory is:
public class SpringDaoFactory {
private static ApplicationContext context;
static {
context = new ClassPathXmlApplicationContext("applicationContext.xml");
}
private SpringDaoFactory(){}
public static DataSource getDataSource() {
return (DataSource) context.getBean("dataSource");
}
public static AddressDao getReservationDao() {
return (AddressDao) context.getBean("reservationDao");
}
}
It cames from Spring configuration:
<bean id="reservationDao" class="gz.cyberbrain.cyberhotel.model.reservation.dao.ReservationSpringDao">
<property name="sessionFactory">
<ref bean="factory"/>
</property>
</bean>
- What is reservationDao?
It's the Data Access Object that manages the persistence of reservations.
- Where is the reservationFacadeDelegate bean actually used?
Code:
It is used in the controller, I only call the updateReservation method and catch the exception:
try {
if (inputTesting(map))
ReservationController.updateReservation((Long) map.get("id"), (String) map.get("reservatorName"), (String) map.get("reservatorCif"), (String) map.get("reservatorAccount"),
(String) map.get("reservatorCard"), (String) map.get("reservatorPhone"), (String) map.get("reservationStatus"), (Calendar) map.get("incomingDate"),
(Calendar) map.get("expectedOutgoingDate"), (Calendar) map.get("trueOutgoingDate"), (Long) map.get("payer"), (Long) map.get("agency"), (Long) map.get("company"),
(String) map.get("notes"), ((Boolean) map.get("byHours")).booleanValue(), vector);
} catch (UnavailableRoomException e) {}
But I think that's not the problem, I use the next DataSource:
Code:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>net.sourceforge.jtds.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:jtds:sqlserver://localhost:4492/hotel</value>
</property>
<property name="username">
<value></value>
</property>
<property name="password">
<value></value>
</property>
</bean>
Now I've tried using the next property of the data source:
Code:
<property name="defaultAutoCommit" value="false"/>
But then commits aren't done, so nothing happens. No commits, no rollbacks.