Here is the code for Home.Java
public class Home extends BasePage {private Session getSession() throws HibernateException {SessionFactory sessionFactory = null; sessionFactory = new Configuration().configure().buildSessionFactory(); return sessionFactory.openSession(); }
// Return the model of the table
public ITableModel getAuthorTable() throws HibernateException
{
Object[] data = null;
Session session = getSession();
Query query = null;
query = session.createQuery("from Author as auth");// Generate a simple sorting column model that uses OGNL to get the column data
ITableColumnModel objColumnModel =
new ExpressionTableColumnModel(new String[] {
"First Name", "getFirstName()",
"Last Name", "getLastName()"
}, true);
data = query.list().toArray(); session.close(); // Create the table model and return it return new SimpleTableModel(data, objColumnModel); } }
Home.page
<page-specification class="tutorial.HibLib.Home"> <description>Hibernate Library Tutorial Home page</description> <context-asset name="stylesheet" path="css/stylesheet.css"/>
<component id="shell" type="Shell">
<binding name="title" expression="page.engine.specification.name" />
</component>
<component id="InstertAuthorTable" type="contrib:Table">
<binding name="tableModel" expression="AuthorTable"/>
</component>
</page-specification>Thanks
Frank
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
