Překlady a základ JSP(X).
1.1 --- a/java/HibernateDemo1/HibernateDemo1-ejb/src/conf/Cil.hbm.xml Sat Mar 14 22:22:46 2009 +0100
1.2 +++ b/java/HibernateDemo1/HibernateDemo1-ejb/src/conf/Cil.hbm.xml Sat Mar 14 22:55:11 2009 +0100
1.3 @@ -4,7 +4,7 @@
1.4 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
1.5 <hibernate-mapping>
1.6 <class name="cz.frantovo.hibernateDemo1.dto.Cil" table="cil">
1.7 - <id name="id" column="id"/>
1.8 + <id name="id" column="id" type="long"/>
1.9 <property name="nazev" column="nazev"/>
1.10 <property name="url" column="url"/>
1.11 </class>
2.1 --- a/java/HibernateDemo1/HibernateDemo1-ejb/src/conf/persistence.xml Sat Mar 14 22:22:46 2009 +0100
2.2 +++ b/java/HibernateDemo1/HibernateDemo1-ejb/src/conf/persistence.xml Sat Mar 14 22:55:11 2009 +0100
2.3 @@ -2,18 +2,16 @@
2.4 <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
2.5 <persistence-unit name="HibernateDemo1-PU" transaction-type="JTA">
2.6 <provider>org.hibernate.ejb.HibernatePersistence</provider>
2.7 - <jta-data-source>jdbc/hrisnicispameri</jta-data-source>
2.8 + <jta-data-source>jdbc/HrisniciSpameri</jta-data-source>
2.9 <exclude-unlisted-classes>false</exclude-unlisted-classes>
2.10 <properties>
2.11 <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
2.12 - <property name="hibernate.hbm2ddl.auto" value="create" />
2.13 - <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
2.14 - <property name="hibernate.cache.use_query_cache" value="true" />
2.15 + <property name="hibernate.hbm2ddl.auto" value="validate" />
2.16 <property name="hibernate.max_fetch_depth " value="3" />
2.17 <property name="hibernate.default_batch_fetch_size" value="16" />
2.18 <property name="hibernate.order_updates" value="true" />
2.19 <property name="hibernate.order_inserts" value="true" />
2.20 - <property name="hibernate.show_sql" value="false"/>
2.21 + <property name="hibernate.show_sql" value="true"/>
2.22 </properties>
2.23 </persistence-unit>
2.24 </persistence>
2.25 \ No newline at end of file
3.1 --- a/java/HibernateDemo1/HibernateDemo1-ejb/src/java/cz/frantovo/hibernateDemo1/CilDAOBean.java Sat Mar 14 22:22:46 2009 +0100
3.2 +++ b/java/HibernateDemo1/HibernateDemo1-ejb/src/java/cz/frantovo/hibernateDemo1/CilDAOBean.java Sat Mar 14 22:55:11 2009 +0100
3.3 @@ -5,6 +5,7 @@
3.4 import javax.ejb.Stateless;
3.5 import javax.persistence.EntityManager;
3.6 import javax.persistence.PersistenceContext;
3.7 +import javax.persistence.Query;
3.8
3.9 /**
3.10 *
3.11 @@ -12,13 +13,17 @@
3.12 */
3.13 @Stateless
3.14 public class CilDAOBean implements CilDAORemote {
3.15 -
3.16 - public static final String PU = "HibernateDemo1-PU";
3.17
3.18 + private static final String PU = "HibernateDemo1-PU";
3.19 @PersistenceContext(unitName = PU)
3.20 private EntityManager em;
3.21
3.22 public Collection<Cil> getCile() {
3.23 - throw new UnsupportedOperationException("Not supported yet.");
3.24 + Query dotaz = em.createQuery("from " + t(Cil.class) + " o order by nazev");
3.25 + return dotaz.getResultList();
3.26 + }
3.27 +
3.28 + private static String t(Class trida) {
3.29 + return trida.getSimpleName();
3.30 }
3.31 }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/java/HibernateDemo1/HibernateDemo1-war/src/java/cz/frantovo/hibernateDemo/preklady.properties Sat Mar 14 22:55:11 2009 +0100
4.3 @@ -0,0 +1,1 @@
4.4 +preklady_cs.properties
4.5 \ No newline at end of file
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/java/HibernateDemo1/HibernateDemo1-war/src/java/cz/frantovo/hibernateDemo/preklady_cs.properties Sat Mar 14 22:55:11 2009 +0100
5.3 @@ -0,0 +1,2 @@
5.4 +nazev=HibernateDemo1
5.5 +jazyk=\u010De\u0161tina
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/java/HibernateDemo1/HibernateDemo1-war/src/java/cz/frantovo/hibernateDemo/preklady_en.properties Sat Mar 14 22:55:11 2009 +0100
6.3 @@ -0,0 +1,2 @@
6.4 +nazev=HibernateDemo1
6.5 +jazyk=angli\u010Dtina
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/java/HibernateDemo1/HibernateDemo1-war/web/WEB-INF/casti/seznamCilu.jspx Sat Mar 14 22:55:11 2009 +0100
7.3 @@ -0,0 +1,6 @@
7.4 +<?xml version="1.0" encoding="UTF-8"?>
7.5 +<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
7.6 +
7.7 + <p>ahoj</p>
7.8 +
7.9 +</jsp:root>
8.1 --- a/java/HibernateDemo1/HibernateDemo1-war/web/index.jsp Sat Mar 14 22:22:46 2009 +0100
8.2 +++ b/java/HibernateDemo1/HibernateDemo1-war/web/index.jsp Sat Mar 14 22:55:11 2009 +0100
8.3 @@ -1,19 +1,18 @@
8.4 -<%--
8.5 - Document : index
8.6 - Created on : 14.3.2009, 21:22:28
8.7 - Author : fiki
8.8 ---%>
8.9 +<%@page contentType="text/html" pageEncoding="UTF-8"%>
8.10 +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
8.11 +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
8.12 +<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
8.13
8.14 -<%@page contentType="text/html" pageEncoding="UTF-8"%>
8.15 -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
8.16 - "http://www.w3.org/TR/html4/loose.dtd">
8.17 +<fmt:setBundle basename="cz.frantovo.hibernateDemo.preklady" scope="application"/>
8.18
8.19 -<html>
8.20 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
8.21 <head>
8.22 - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8.23 - <title>JSP Page</title>
8.24 + <meta http-equiv="content-language" content="cs"/>
8.25 + <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
8.26 + <title><fmt:message key="nazev"/></title>
8.27 </head>
8.28 <body>
8.29 - <h1>Hello World!</h1>
8.30 + <h1><fmt:message key="nazev"/></h1>
8.31 + <jsp:include page="WEB-INF/casti/seznamCilu.jspx"/>
8.32 </body>
8.33 </html>