May be you understand, but don't know why you didn't any attempt to resolve it. If you want to display data, first you should put it in the database. Check the data is available, connecting to it via the client application. There's many ways to connect to the database, including a JDBC client application supplied with the IDE. It also takes a connection properties right from your hibernate.cfg.xml
and has capability to test the connection. Also, make sure the credential used to connect to the database has DML/DDL access privileges to the schema which should be probably created manually.
This file is for hibernate configuration, that you should take attention on it, to be valid due to a correct DTD corresponding to the version of hibernate.
Then, you are using annotation based mapping, and it also should be configured in the configuration file.
Next, DAO is not supposed to extend the HibernateUtil
and putting a static
property for the session
is a disaster. DAOs should not have static
properties. If you want to get a session use HibernateUtil.getSession()
and don't forget to close session at the end of transaction. I guess you still didn't implement what I have proposed in the previous answer, so you don't know how to get the session from thread. Anyway opening a session in the constructor is only works a first time you use the session, and it's not longer available after you close it. Open a session in the method before you start a transaction.
Next, ModelDriven
is better described by @Quaternion, a few words about your model: your model is only used to view a user
and doesn't contain properties to display users
.
Lastly, method execute
is a default method used by the action configuration, you shouldn't map this method, unless you know what are you doing.