目前分類:JAVA小筆記 (13)

瀏覽方式: 標題列表 簡短摘要
  • 為了方便取得SessionFactory實例,可撰寫一個test.com.util .HibernateUtil類別:

    package test.com.util;

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

開始Hibernate:

  • 對於該Table建立一個對應的test.com.hbm.User.hbm.xml:

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

說明:

    Hibernate 是「物件/關係對應」ORM(Object/Relational Mapping)的解決方案,簡單說就是物件對應關係,將JAVA中物件映射至關聯式資料庫中的表格, Hibernate 提供了這個過程中自動對應轉換的方案。

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

  • 下載proxool,下載網址:http://proxool.sourceforge.net/
  • 解壓縮後將其中 proxool-0.9.1.jar、proxool-cglib.jar 放入專案中WEB-INF/libs(依各專案設定)
  • 於 hibernate.cfg.xml 同一層目錄下新增一XML檔 proxool.cfg.xml,檔案內容如下:

<?xml version="1.0" encoding="utf-8"?>
<!-- the proxool configuration can be embedded within your own application's.

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

目錄:
一、術語session

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

Apache SSL

一、預備檔案

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

24小時制日期顯示:
public class Datetime {

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

Timer與TimerTask應用。利用  timer.schedule(new RemindTask() , now, minutes * 2 * 1000),來實現從程式啟動後每隔幾秒鐘執行一次應用程式,並限定執行幾次後程式自動停止,範例如下:

package testjava;

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

var hex_chr = "0123456789abcdef";
function rhex(num)

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

  在一個應用系統中常要定時去執行某些程式, 例如: 同步異質平台的資料, 或是定時發信件; Java是一種跨平台(Window/Linux)的程式語言, 雖然在 Window 平台可以用 AT 指令來作排程, 在 Linux 可以用 crontab 來排程, 但總是無法與系統作密切的結合.
quartz是個不錯的選擇, 它一樣可以跨異質平台作業, 而且與 Java 的結合也很密切, 只要在Java程式段有

public void execute(JobExecutionContext context)

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

參考程式碼如下:

import java.io.*;

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

Java Opensources for Web Development Part I:嘗試使用來自 Opensource 的小工具(1)
Lession 5 : JasperReport

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()

HowTo configure the C3P0 connection pool

Configuration

Here is a sample of C3P0 configuration. This is an extract of hibernate.cfg.xml:

<!-- configuration pool via c3p0--> 
<property name="c3p0.acquire_increment">1</property> 
<property name="c3p0.idle_test_period">100</property> <!-- seconds --> 
<property name="c3p0.max_size">100</property> 
<property name="c3p0.max_statements">0</property> 
<property name="c3p0.min_size">10</property> 
<property name="c3p0.timeout">100</property> <!-- seconds --> 
<!-- DEPRECATED very expensive property name="c3p0.validate>--> 

You also can set extra c3p0 properties using c3p0.properties. Put this file in the classpath (WEB-INF/classes for example), but be careful, the previous values will be overridden by Hibernate whether set or not (see below for more details). For more information on C3P0 configuration, please have a look at http://sourceforge.net/projects/c3p0 and unzip the download, there is a doc folder where you'll find everything you need.

楊 bey kuen 發表在 痞客邦 留言(0) 人氣()