如何使用 apache torque (一)

Apache Torque是一个使用关系数据库作为存储手段的Java应用程序持久化工具,是 Apache 的公开源代码项目,Torque是一个开源项目,由Web应用程序框架Jakarta Apache Turbine发展而来,但现在已完全独立于Turbine。 Torque 主要包含两部分:一部分是 Generator,它可以使用xml文件,产生应用程序需要的所有数据库资源,包括 sql 和 java 文件;另外一部分是 Runtime,提供使用这些代码访问数据库的运行时环境。

torque作为orm,我一般是自己手工编写xml文件,通过xml文件,生成sql脚本和java对象文件,但由于在实际项目过程中,很难做到表结构不变动,很多时间需要花在xml文件的维护和java对象文件的更换上,在几个实际项目中使用过后,就放弃了。放弃的原因主要有:1、项目组的兄弟多数比较抵制操作java对象来进行数据库,因为他们看不到自己比较熟悉的sql了;2、使用orm工具多少需要些时间来学习工具的使用,虽然相对于现在hibernate,torque还是比较简单的;3、在项目中,也很难做到数据库设计不变化,另外旧就是我现在所在公司大量使用oracle存储过程;4、在大多数时候,项目总是由最少的人,干尽可能多的事情,所以在很多时候,你不得不放弃一些所谓的技术和理念,用最短的时间将事情搞定,你才能获得上司的认可。尤其在我目前所在公司,一个千万级别的项目,也仅仅是3~5个人来完成,作为项目经理,除了要做数据库设计、存储过程编写、框架搭建、新人培训(因为3~5个人里面也许就你一个是有经验的人)、硬件设备收货、机器上架、网络打通(如果你还会调试路由器,这个事情也属于你来搞定的范畴)协调、各种外系统接口梳理和定义、外系统相关公司协调,呵呵,我经常戏虐公司的项目经理是十项全能选手,因为你的上司还要求你要有销售意识。
扯远了,如何使用torque作为orm我就不写了,我现在一般使用torque作为数据库访问工具,如何将torque引入你的系统(非web应用,独立应用程序),以oracle作为实际例子:
第一步:引入包
classes12.jar
log4j-1.2.15.jar
commons-beanutils-1.7.0.jar
commons-collections-3.1.jar
commons-configuration-1.1.jar
commons-dbcp-1.2.2.jar(如果你还在使用commons-dbcp-1.2.2.jar以下版本作为数据库连接池,都请更新到commons-dbcp-1.2.2.jar)
commons-lang-2.1.jar
commons-logging-1.0.4.jar
commons-pool-1.2.jar
commons-discovery-0.2.jar
torque-3.2.jar
village-2.0-dev-20030825.jar

第二步:配置torque.properties 和 log4j.properties ,配置文件我一般放在classes目录下
1、torque.properties

# -------------------------------------------------------------------
# $Id: Torque.properties,v 1.11.2.2 2004/08/24 04:14:32 seade Exp $
#
# This is the configuration file for Torque.
#
# Note that strings containing "," (comma) characters must backslash
# escape the comma (i.e. '\,')
#
# -------------------------------------------------------------------

torque.applicationRoot = .

# -------------------------------------------------------------------
#
# L O G G I N G
#
# -------------------------------------------------------------------
# We use Log4J for all Torque logging and we embed the log4j
# properties within our application configuration.
# -------------------------------------------------------------------

# This first category is required and the category
# must be named 'default'. This is used for all logging
# where an explicit category is not specified.

log4j.category.org.apache.torque = ALL, org.apache.torque
log4j.appender.org.apache.torque = org.apache.log4j.FileAppender
#log4j.appender.org.apache.torque.file = d:/work/logs/torque.log
log4j.appender.org.apache.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.org.apache.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.org.apache.torque.append = false

# -------------------------------------------------------------------
#
# T O R Q U E P R O P E R T I E S
#
# -------------------------------------------------------------------
# These are your database settings. Look in the
# org.apache.torque.pool.* packages for more information.
#
# The parameters to connect to the default database. You MUST
# configure these properly.
# -------------------------------------------------------------------

torque.database.default=mydb
torque.database.mydb.adapter=oracle

# # Using commons-dbcp
torque.dsfactory.mydb.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory
torque.dsfactory.mydb.pool.maxIdle=8
torque.dsfactory.mydb.pool.maxActive=10
torque.dsfactory.mydb.pool.testOnBorrow=true
torque.dsfactory.mydb.pool.validationQuery=select * from dual
torque.dsfactory.mydb.connection.driver = oracle.jdbc.driver.OracleDriver
torque.dsfactory.mydb.connection.url = jdbc:oracle:thin:@192.168.12.186:1521:mydb
torque.dsfactory.mydb.connection.user = myname
torque.dsfactory.mydb.connection.password = mypwd

# Determines if the quantity column of the IDBroker's id_table should
# be increased automatically if requests for ids reaches a high
# volume.

torque.idbroker.clever.quantity=false

# Determines whether the managers cache instances of the business objects.
# And also whether the MethodResultCache will really cache results.

torque.manager.useCache = true


2、log4j.properties

# ------------------------------------------------------------------------
#
# Logging Configuration
#
# $Id: log4j.properties,v 1.10 2005/07/27 04:25:09 huangxq Exp $
#
# ------------------------------------------------------------------------


#
# If we don't know the logging facility, put it into the
# ideal.log
#
log4j.rootLogger = error, stdout

#
# Application debugging
#
log4j.category.com.yh = DEBUG, stdout,ideal
log4j.additivity.com.ideal = false

#
# torque goes into torque Log
#
log4j.category.org.apache.torque = ERROR, torque
log4j.additivity.org.apache.torque = false

########################################################################
#
# Logfile definitions
#
########################################################################

#print out to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%-5p] [%F] %M : %L -- %m%n

#
# root.log
#
log4j.appender.root = org.apache.log4j.RollingFileAppender
log4j.appender.root.MaxFileSize=2000KB
# Keep one backup file
log4j.appender.root.MaxBackupIndex=10
#log4j.appender.root.file = ./logs/root.log
log4j.appender.root.layout = org.apache.log4j.PatternLayout
log4j.appender.root.layout.conversionPattern =%d [%-5p] [%F] : %L -- %m%n
log4j.appender.root.append = false

#
# yh.log
#
log4j.appender.yh = org.apache.log4j.RollingFileAppender
log4j.appender.yh.MaxFileSize=2000KB
# Keep one backup file
log4j.appender.yh.MaxBackupIndex=10
log4j.appender.yh.file = ./logs/yh.log
log4j.appender.yh.layout = org.apache.log4j.PatternLayout
log4j.appender.yh.layout.conversionPattern =%d [%-5p] [%F] : %L -- %m%n
log4j.appender.ideal.append = false

#
# torque.log
#
log4j.appender.torque = org.apache.log4j.RollingFileAppender
log4j.appender.torque.MaxFileSize=2000KB
# Keep one backup file
log4j.appender.torque.MaxBackupIndex=10
#log4j.appender.torque.file = ./logs/torque.log
log4j.appender.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.torque.layout.conversionPattern =%d [%-5p] [%F] : %L -- %m%n
log4j.appender.torque.append = false


第三步:初始化torque
InitServer.java
[code]
package com.yh.core.socket.server;

import java.io.InputStream;
import java.util.List;
import java.util.Properties;

import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.yh.util.DBUtils;
import com.yh.util.FileUtils;
import com.workingdogs.village.Record;

/**
* @author tylzhuang
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/

public class InitServer {

private static Logger log ;
private static final String TORQUE_CONFIG_FILE = "torque.properties";
private static final String LOG4J_CONFIG_FILE = "log4j.properties";
public static boolean init() {
// 初始化
boolean flag = true;
ClassLoader cl = InitServer.class.getClassLoader();
InputStream logIn = null;
InputStream dbIn = null;

try {

logIn = cl.getResourceAsStream(LOG4J_CONFIG_FILE);
Properties p = new Properties();
p.load(logIn);
PropertyConfigurator.configure(p);
log = Logger.getLogger(InitServer.class);
log.debug("InitServer init() log4j init success ---------------" );


//初始化
PropertiesConfiguration dbConfig = new PropertiesConfiguration();
dbIn = cl.getResourceAsStream(TORQUE_CONFIG_FILE);
dbConfig.load(dbIn);
DBUtils.init(dbConfig);
log.debug("InitServer init() Torque init success ---------------" );
String testSql = "select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') from dual";
String time = null;
List list = DBUtils.query(testSql);
if(list!=null&&list.size()>0){
Record record = (Record) list.get(0);
time = record.getValue(1).asString();
log.debug("from db init-time: "+time);
}


}
catch (Exception ex)
{
log.error("InitServer Exception when init() - "+ex);
flag = false;
}
finally
{
FileUtils.closeInputStream(logIn);
FileUtils.closeInputStream(dbIn);
}
return flag;
}

}

[/code]
DBUtils.java
[code]

package com.yh.util;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

import org.apache.commons.configuration.Configuration;
import org.apache.log4j.Logger;
import org.apache.torque.Torque;
import org.apache.torque.util.BasePeer;

/**
* @author tylzhuang
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class DBUtils {
private static Logger log = Logger.getLogger(DBUtils.class.getName());

public DBUtils() {
}

public static boolean init(String dbConfigFile) {
// 初始化torque
boolean flag = true;
try {
Torque.init(dbConfigFile);
System.out.println("---------- 初始化torque成功---------");
} catch (Exception exx) {
log.error(exx);
flag = false;
}
return flag;
}

public static boolean init(Configuration dbConfig) {
// 初始化torque
boolean flag = true;
try {
Torque.init(dbConfig);
System.out.println("---------- 初始化torque成功---------");
} catch (Exception exx) {
log.error(exx);
flag = false;
}
return flag;
}

public static Connection getDBConn() {
// 取得数据库链接
Connection conn = null;
try {
conn = Torque.getConnection();
} catch (Exception exx) {
log.error(exx);
}
return conn;
}

public static Connection getDBConn(String dbName) {
// 取得数据库链接
Connection conn = null;
try {
conn = Torque.getConnection(dbName);
} catch (Exception exx) {
log.error(exx);
}
return conn;
}

public static Connection getDBConn(boolean autoCommitFlag) {
// 取得数据库链接
Connection conn = null;
try {
conn = Torque.getConnection();
setAutoCommit(conn , autoCommitFlag);
} catch (Exception exx) {
log.error(exx);
}
return conn;
}

public static Connection getDBConn(String dbName, boolean autoCommitFlag) {
// 取得数据库链接
Connection conn = null;
try {
conn = Torque.getConnection(dbName);
setAutoCommit(conn , autoCommitFlag);
} catch (Exception exx) {
log.error(exx);
}
return conn;
}

public static void closeDBConn(Connection conn) {
// 关闭数据库链接
try {
if (conn != null) {
setAutoCommit(conn , true);// 无论如何,都应该在连接关闭前,将AutoCommit 设置为
// true
Torque.closeConnection(conn);
conn = null;
}
} catch (Exception exx) {
log.error(exx);
}
}

public static void closeDBConn(Connection conn, boolean autoCommitFlag) {
// 关闭数据库链接
try {
if (conn != null) {
setAutoCommit(conn , true);// 无论传什么值,都应该在连接关闭前,将AutoCommit 设置为
// true
Torque.closeConnection(conn);
conn = null;
}
} catch (Exception exx) {
log.error(exx);
}
}

public static void closeDBStatement(Statement s) {
// 关闭Statement
try {
if (s != null) {
s.close();
s = null;
}
} catch (Exception exx) {
log.error(exx);
}
}

public static void closeDBObject(Statement s, Connection conn) {
// 关闭Statement
try {
if (s != null) {
s.close();
s = null;
}
} catch (Exception exx) {
log.error(exx);
}
// 关闭数据库链接
try {
if (conn != null) {
setAutoCommit(conn , true);// 无论如何,都应该在连接关闭前,将AutoCommit 设置为
// true
Torque.closeConnection(conn);
conn = null;
}
} catch (Exception exx) {
log.error(exx);
}
}
public static void closeDBResultSet(ResultSet r) {
// 关闭ResultSet
try {
if (r != null) {
r.close();
r = null;
}
} catch (Exception exx) {
log.error(exx);
}
}
public static void closeDBObject(Statement s, Connection conn,
boolean autoCommitFlag) {
// 关闭Statement
try {
if (s != null) {
s.close();
s = null;
}
} catch (Exception exx) {
log.error(exx);
}

// 关闭数据库链接
try {
if (conn != null) {
setAutoCommit(conn , true);// 无论传什么值,都应该在连接关闭前,将AutoCommit 设置为
// true
Torque.closeConnection(conn);
conn = null;
}
} catch (Exception exx) {
log.error(exx);
}
}
public static void closeDBObject(Statement s, ResultSet r ,Connection conn,
boolean autoCommitFlag) {
// 关闭Statement
try {
if (s != null) {
s.close();
s = null;
}
} catch (Exception exx) {
log.error(exx);
}
// 关闭ResultSet
try {
if (r != null) {
r.close();
r = null;
}
} catch (Exception exx) {
log.error(exx);
}
// 关闭数据库链接
try {
if (conn != null) {
setAutoCommit(conn , true);// 无论传什么值,都应该在连接关闭前,将AutoCommit 设置为
// true
Torque.closeConnection(conn);
conn = null;
}
} catch (Exception exx) {
log.error(exx);
}
}

public static void commit(Connection conn) {
try {
if (conn != null) {
if (conn.getMetaData().supportsTransactions()
&& conn.getAutoCommit() == false)
{
conn.commit();
conn.setAutoCommit(true);
}
}
} catch (Exception exx) {
log.error(exx);
}
}

public static void rollback(Connection conn) {
try {
if (conn != null) {
if (conn.getMetaData().supportsTransactions()
&& conn.getAutoCommit() == false)
{
conn.rollback();
conn.setAutoCommit(true);
}
}
} catch (Exception ee) {
log.error(ee);
}
}
public static void setAutoCommit(Connection conn , boolean autoCommitFlag)
{
try
{
if (conn.getMetaData().supportsTransactions())
{
conn.setAutoCommit(autoCommitFlag);
}
}
catch (Exception e)
{
log.error(e);
}
}

public static List query(String querySql) {
List results = null;
try {
results = BasePeer.executeQuery(querySql);
} catch (Exception ee) {
results = null;
log.error(ee);
}
return results;
}
// singleRecord = true 表示只返回一条记录
// singleRecord = false 表示返回所有记录
public static List query(Connection conn, boolean singleRecord,
String querySql) {
List results = null;
try {
if (conn != null) {
results = BasePeer.executeQuery(querySql, singleRecord, conn);
}
} catch (Exception ee) {
results = null;
log.error(ee);
}
return results;
}
// singleRecord = true 表示只返回一条记录
// singleRecord = false 表示返回所有记录
public static List query(Connection conn,
String querySql) {
List results = null;
boolean singleRecord = false;
results = query(conn , singleRecord , querySql);
return results;
}

//查询数据库指定配置的数据库
public static List query(String dbName ,String querySql) {
List results = null;
try {
Connection conn = DBUtils.getDBConn(dbName);
if(conn != null)
results = query(conn , querySql);
else
results = null;
} catch (Exception ee) {
results = null;
log.error(ee);
}
return results;
}

public static int insertOrUpdate(String insertSql) {
int results = -1;
try {
results = BasePeer.executeStatement(insertSql);
} catch (Exception ee) {
results = -1;
log.error(ee);
}
return results;
}

public static int insertOrUpdate(Connection conn, String insertSql) {
int results = -1;
try {
if (conn != null) {
results = BasePeer.executeStatement(insertSql, conn);
}
} catch (Exception ee) {
results = -1;
log.error(ee);
}
return results;
}



}
[/code]
极路由 极1s J1S hc5661 刷padavan固件 极路由1S刷机指南 准备工作: 下载Breed不死固件 通过WinSCP上传或直接wget获取 执行mtd命令写入Breed 关键步骤: 进入Breed控制台(按住Reset键开机) 备份原厂固件和密钥 下载Padavan固件(RT-N14U-GPIO-12-xiaodu-ji1S-128M.trx) 刷机过程: 在Breed控制台更新固件 等待自动重启完成 初始设置: 管理地址:192.168.123.1 默认账号:admin/admin 无线名称:PCDN 无线密码:1234567890 注意事项:切勿 阅读详情

相关推荐

SOC设计必看!Tessent DRC检查中最容易踩的5个坑(附解决方案)

本文针对SOC设计中Tessent DRC检查的常见问题,详细分析了5个最易忽视的陷阱,包括时钟域交叉、扫描链虚连、多电压域规则等,并提供专业解决方案。特别针对芯片设计中的DFT验证难点,分享了经过验证的调试方法和Tessent工具使用技巧,帮助工程师提升DRC检查效率。

weixin_29280657的博客 501

Apache Torque入门学习

Introduction Apache Torque is an object-relational mapper for java. In other words, Torque lets you access and manipulate data in a relational database using java objects. Unlike most other object-re...

weixin_30316097的博客 239

PVE 9.0 保姆级安装及优化教程(换源、网络配置、远程唤醒等)【基础篇】

最近,Proxmox VE 推出了基于 Debian 13 的 9.0 版本。正巧我手头有一台闲置的老电脑,与其闲置,不如装上 PVE,让它化身 All in One,继续发挥它的余热。G4560 算是一颗 NAS 神 U,十几元的售价就能有双核四线程,比起什么 J1900 不知道强到哪里去了,尽管定位上是奔腾处理器,但性能甚至能和同代的酷睿 i3-7100 掰掰手腕,并且它还自带 HD 610 的核显,对于解码的支持也还不错。

zc_mk的博客 7549

使用Torque访问数据库

  文章摘要 Torque项目是Apache的公开源代码项目,主要用于生成访问数据库的资源和java代码、提供使用这些代码访问数据库的运行时(runti

771

从零到一:构建嵌入式Arm-Linux的Qt MQTT通信框架全指南

本文详细指导如何在嵌入式Arm-Linux平台上从零构建Qt MQTT通信框架,涵盖交叉编译、环境配置、依赖库管理及性能优化。重点针对32位Arm架构,提供完整的工具链配置、编译步骤和实战部署方案,适用于物联网和工业控制等场景。

w8x9y0z1的博客 1002

Ubuntu 22.04 LTS下Xenomai 3.3实时内核配置全攻略(附常见错误排查)

本文详细介绍了在Ubuntu 22.04 LTS系统上配置Xenomai 3.3实时内核的完整流程,包括环境准备、内核补丁应用、编译优化及常见错误排查。特别针对工业自动化和机器人控制场景,提供了性能优化建议和故障解决方案,帮助开发者实现毫秒级精度的实时任务处理。

weixin_29268385的博客 474

代码生成机-Torque

Torque是Apache中对数据库操作的一个框架,利用其generator可以扩展为代码生成机;设计数据库后利用generator 生成应用程序。 torque.database.schema = HITV schema大小写敏感 Torque is an object-relational mapper for java. In other words, Torque

1218

别再魔改LWIP了!用STM32CubeMX配置F407的TCP保活(KeepAlive)与自动重连

本文详细介绍了如何通过STM32CubeMX配置STM32F407的LWIP协议栈,实现TCP保活(KeepAlive)与自动重连功能,解决网络异常断开问题。文章提供了从基础环境配置到自动重连架构设计的完整指南,帮助开发者构建高可靠的网络连接机制,适用于工业物联网和嵌入式设备开发。

weixin_27038245的博客 241

Apache Torque的关键配置参数 (DBCP)

起因频繁的connection close/open.DBA点名:有个component从3个礼拜前突然开始频率的打开/关闭db的connection,大大抵消了使用connection pool的好处调查经探索发现,该component使用Torque来进行db connect

FireCoder的专栏 2753

数字摄影与摄像中的图像信号处理器(ISP):流程与经典算法详解

图像信号处理器(Image Signal Processor, ISP)是现代数字成像系统(如智能手机、数码相机、网络摄像头等)中的核心组件,扮演着将图像传感器(如CMOS或CCD)捕获的原始光电信号转换为高质量、可供观看或进一步处理的数字图像的关键角色。在数字摄影和摄像的整个链路中,光线首先通过镜头(Lens)聚焦到图像传感器上,传感器将光信号转换为模拟电信号,随后经过模数转换(A/D转换)变为原始的数字图像信号。

qq_44682523的博客 3757

vs code , 配置 claude code 插件, 默认选项 : --dangerously-skip-permission

摘要:本文介绍如何在VS Code中为Claude Code插件配置--dangerously-skip-permission参数,包含两种方法:图形界面设置(适合新手)和直接编辑settings.json(精准配置)。该参数会跳过权限检查,仅建议在本地测试环境中使用。配置后需通过命令面板验证参数是否生效,并注意安全风险,避免在生产环境使用。多参数配置时需用数组格式,不同版本插件可能键名略有差异。

AI天才研究院 5051

Torque:Apache又一O/R Mapping框架

官方主页:http://db.apache.org/torque/index.html本文是在阅读http://www.blogjava.net/fanyingjie/archive/2008/05/22/202109.html的基础上进行的一些补充。使用的版本是:3.3。 这个O/R Mapping框架虽然不像Hibernate那样实现强大,但在很多方面都体现出他的易用性。步

【昆山人在上海】 1365

【Python基础】FastAPI 从入门到项目实战操作详解

【Python基础】FastAPI从入门到使用实战操作详解

congge_study的博客 483

Apache Torque 应用总结

1、直接运行SQL语句//要用BasePeer.executeQuery(sqlStr)int recRightCount = ((Record) BasePeer.executeQuery("select count(*) as rightCount from tbluser_right_def").get(0)).getValue(1).asInt(); List list = BasePee

Freaky ?!…… 2846

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

[Apache-Torque] Torque学习概要

Torque学习概要                                                                                              1.        Torque介绍Torque是一个持久层框架,也是jakarta的一个子项目,原来包括在Turbine框架中,从Turbine2.2开始Torque被分离出来作

Fitzwilliam的专栏 3058

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

安装 TORQUE

编译 下载 TORQUE 源代码:http://www.clusterresources.com/downloads/torque/ 。解压缩后进行编译。 $ tar zxvf torque-2.3.3.tar.gz$ cd torque-2.3.3$ ./configure --with-scp$ make$ sudo make install 如果有多台机器需要安装,可以使用 to...

live123的专栏 527

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

如何使用 apache torque (二)

在如何使用 apache torque (一)中已经写过如何在非web应用里面使用torque,这里写如何在web应用里使用torque,以struts为例: 第一步和第二步参考如何使用 apache torque (一) 第三步:初始化torque ,我采用扩展 ActionServlet.java 实现 ExtendActionServlet.java [code] package ...

tylzhuang 274

Apache Torque实现分页查询

1.分页查询工具类 2.测试类 Apache Torque实现分页查询 Torque的初始化参见Apache Torque连接多个数据库及其使用 1.分页查询工具类 import java.util.List; import org.apache.torque.TorqueException; import org.apache.torque.util.LargeSelectE...

Life is for sharing的博客 983

Apache Torque连接多个数据库及其使用

1.参见官网上Torque的初始化和配置 2.torque.properties配置 3.log4j.properties配置 4.初始化Torque 5.使用 1.参见官网上Torque的初始化和配置 Database handles(数据库句柄) A database handle is the name attribute that was used in...

Life is for sharing的博客 1284

Apache Torque的使用

这篇文章学习如何使用Torque,作为一个ORM(a tool that maps relational databases to java classes) 用Torque访问数据库,需要如下步骤 定义描述数据库结构(tables, columns等)的schema文件 通过schema生成classes和数据库 使用生成的类 (and the torque-runtime libr...

weixin_30767921的博客 266

Torque中的一些问题

Torque中的一些问题说明:这里描述的问题来自: Torque3.1.1, Village2.0 dev,文中用到的代码来自开源Apache项目. 文中虽例子,但主要是辅助说明错误原因和解决办法.以给使用Turbine+Torque+Velocity的人一点帮助.   Torque是apache数据库项目中一个子项目,它实现数据库的持久层,是JDO的Apache实现.自从和Turbine项目分出

keepeye的专栏 2216

[Apache-Torque] Runtime Relevant Classes

PeersEverything in Peers resolve around Peer classes. A Peer class has a one-to-one mapping to a Database table. You use each tables associated Peer class to do operations on that table. Peer cla

Fitzwilliam的专栏 1399

Apache Jakarta 项目介绍

Apache Jakarta 项目介绍 分类: 文摘/行业知 Apache Jakarta apache是一个开源的组织名。后来制定了一个以apache命名的开源协议。  jakarta是apache组织下的一套Java解决方案的开源软件的名称,它包括了很多子项目。 apache工程jakarta(雅加达)家族介绍 Apache Ant

ccecwg的专栏 2602

[openSource]torque + velocity = 代码生成器

Apache Torque是一个使用关系数据库作为存储手段的Java应用程序持久化工具,是 Apache 的公开源代码项目,Torque是一个开源项目,由Web应用程序框架Jakarta Apache Turbine发展而来,但现在已完全独立于Turbine。 Torque 主要包含两部分:一部分是 Generator,它可以产生应用程序需要的所有数据库资源,包括 sql 和 java 文件;另外

1759

探索Apache Turbine:构建强大Web应用的高效引擎

探索Apache Turbine:构建强大Web应用的高效引擎 项目介绍 Apache Turbine 是一个成熟的Java Web应用程序框架,旨在简化企业级Web应用的开发与部署过程。自诞生以来,它已经成为开发者手中的利器,通过其精心设计的架构和丰富的功能集,让复杂的应用逻辑变得易于管理和扩展。Turbine不仅仅是一个代码库,它是构建高性能、可维护Web解决方案的强大支持系统。 项目技术分...

gitblog_00002的博客 1031

Apache DdlUtils 使用教程

Apache DdlUtils 使用教程 项目介绍 Apache DdlUtils 是一个用于处理数据库定义(DDL)文件的小型、易于使用的组件。这些 DDL 文件是包含数据库模式定义(如表和列)的 XML 文件。DdlUtils 可以通过其 Ant 任务或编程方式将这些文件输入,以创建相应的数据库或修改现有数据库,使其与 DDL 文件中的定义一致。同样,DdlUtils 也可以为现有数据库生成 ...

gitblog_00898的博客 1203
上一篇: 扬州!
下一篇: 如何使用 apache torque (二)
iteye_12521
博客等级 码龄8年 0粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值