This article is original, reproduced please indicate the source http://blog.9cbs.net/china2wto Author: china2wto on www.hibernate.org.cn site has a good learning struts hibernate example: Download example code: http: //www.hibernate.org.cn/download/poweracl.rar But author dingy only left the program code, did not leave how to deploy, I wrote my deployment process, I hope Dingyd or other masters can give pointers .
The following is assumed that you will use Tomcat5 and MySQL4 and have been installed normally.
After decompression, copy the PowerACl directory and CSS, LOG, PICS, TEMPLATES, Web-INF subdirectory to the Tomcat / WebApps directory.
Modify PowerAffl / Web-Inf / Log4j.properties files below: log4j.Appender.r.file =% Your webapp directory% / PoweraCl / log
MySQL New Newhr database. Establish a database and table according to PowerAffl.hbm.xml file, the following is SQL code:
========================================================= # mysql -Front dump 2.4 ## host: localhost database: Newhr # ------------------------------------- ------------------- # Server Version 4.0.14-NT
## Table Structure for Table 'ACL_GROUP' # #
Create Table `ACL_GROUP` (` Groupid` int (4) Not null auto_increment, `Groupname` Varchar (99) Default Null, Primary Key (` Groupid`) type = myisam;
## DUMPING DATA for TABLE 'ACL_GROUP' # INSERT INTO ACL_GROUP VALUES ("1", "Network"); INSERT INTO ACL_GROUP VALUES ("2", "Hardware"); Insert Into ACL_GROUP VALUES ("3", "Software" );
## Table Structure for Table 'ACL_GROUP_INFO' #
CREATE TABLE `acl_group_info` (` id` int (4) unsigned NOT NULL auto_increment, `infoid` int (4) unsigned default NULL,` groupid` int (4) unsigned default NULL, PRIMARY KEY ( `id`)) TYPE = Myisam;
## DUMPING DATA for TABLE 'ACL_GROUP_INFO' # INSERT INTO ACL_GROUP_INFO VALUES ("1", "1", "1"); INSERT INTO ACL_GROUP_INFO VALUES ("2", "2", "1"); INSERT INTO ACL_GROUP_INFO VALUES ("3", "1", "2"); INSERT INTO ACL_GROUP_INFO VALUES ("4", "2", "2"); INSERT INTO ACL_GROUP_INFO VALUES ("5", "1", "3"); ## Table structure for table 'ACL_INFO' #
CREATE TABLE `acl_info` (` infoid` int (4) unsigned NOT NULL auto_increment, `infoname` varchar (99) default NULL,` extinfo` varchar (99) default NULL, PRIMARY KEY ( `infoid`)) TYPE = MyISAM;
## DUMPING DATA for Table 'ACL_INFO' # INSERT INTO ACL_INFO VALUES ("1", "Service", "Domain Service"); Insert Into ACL_INFO VALUES ("2", "Manufactory", "Factory");
## Table Structure for Table 'ACL_PERMISSION' # #
Create Table `ACL_PERMISSION` Int (4) unsigned not null auto_increment,` permissionname` VARCHAR (99) Default Null, Primary Key (`permissionid)) type = myisam;
## DUMPING DATA for TABLE 'ACL_PERMISSION' # INSERT INTO ACL_PERMISSION VALUES ("1", "Object"); INSERT INTO ACL_PERMISSION VALUES ("2", "System"); INSERT INTO ACL_PERMISSION VALUES ("3", "SYSDB" );
## Table structure for table 'ACL_ROLE' # #
Create Table `ACL_ROLE` (` Roleid` int (4) unsigned not null auto_increment, `RoleName` VARCHAR (99) Default Null, Primary Key (` roleid`) Type = Myisam;
## DUMPING DATA for TABLE 'ACL_ROLE' # INSERT INTO ACL_ROLE VALUES ("1", "CEO"); INSERT INTO ACL_ROLE VALUES ("2", "Manager"); INSERT INTO ACL_ROLE VALUES ("3", "Employee" ); INSERT INTO ACL_ROLE VALUES ("4", "Temp"); ## Table Structure for Table 'ACL_ROLE_PERMISSION' #
CREATE TABLE `acl_role_permission` (` id` int (4) unsigned NOT NULL auto_increment, `roleid` int (4) unsigned default NULL,` permissionid` int (4) unsigned default NULL, PRIMARY KEY ( `id`)) TYPE = Myisam;
## DUMPING DATA for Table 'ACL_ROLE_PERMISSION' # INSERT INTO ACL_ROLE_PERMISSION VALUES ("1", "1", "1"); INSERT INTO ACL_ROLE_PERMISSION VALUES ("2", "1", "2"); INSERT INTO ACL_ROLE_PERMISSION VALUES ("3", "1", "3"); INSERT INTO ACL_ROLE_PERMISSION VALUES ("4", "2", "1"); INSERT INTO ACL_ROLE_PERMISSION VALUES ("5", "2", "3"); INSERT INTO ACL_ROLE_PERMISSION VALUES ("6", "2", "2"); INSERT INTO ACL_ROLE_PERMISSION VALUES ("7", "3", "1"); INSERT INTO ACL_ROLE_PERMISSION VALUES ("8", "4", " 1");
## TABLE STRUCTURE for TABLE 'ACL_USER_GROUP_ROLE' #
CREATE TABLE `acl_user_group_role` (` id` int (4) unsigned NOT NULL auto_increment, `loginname` char (16) default NULL,` groupid` int (4) unsigned default NULL, `roleid` int (4) unsigned default NULL, PRIMARY Key (`ID`). Type = Myisam;
## DUMPING DATA for TABLE '# INSERT INTO ACL_USER_GROUP_ROLE VALUES ("1", "DingYD", "1", "1"); Insert Into ACL_USER_GROUP_ROLE VALUES ("2", "Dingyd", "2", " 1 "); INSERT INTO ACL_USER_USER_GROUP_ROLE VALUES (" 3 "," Dingyd "," 3 "," 1 "); INSERT INTO ACL_USER_GROUP_ROLE VALUES (" 4 "," FD "," 3 "," 4 "); Insert Into ACL_USER_GROUP_ROLE VALUES ("5", "FD", "2", "4"); INSERT INTO ACL_USER_GROUP_ROLE VALUES ("6", "Shi", "3", "2"); INSERT INTO ACL_USER_GROUP_ROLE VALUES ("7" , "Bill", "3", "3"); ## Table structure for table 'app_user' #
Create Table `App_user` (` Loginname` Varchar (16) Not null default '0', `Password` VARCHAR (20) Default Null,` Name` Varchar (20) Default Null, `Email` VARCHAR (60) Default NULL, `Modifier` Date Default Null,` Creater` Date Default Null, `LastLogin` Date Default Null, Primary Key (` Loginname`).
## DUMPING DATA for Table 'App_User' # INSERT INTO APP_USER VALUES ("shi", "111", "shiwf", "abc@sina.com.cn", "2005-01-01", "2005-01- 01 "," 2005-01-01 "); INSERT INTO APP_USER VALUES (" Dingyd "," 111 "," Dingyd "," Dingyd "," 2005-01-01 "," 2005-01-01 "," 2005-01-01 "); Insert INTO APP_USER VALUES (" FD "," 111 "," FD "," fd@fd.com ", null, null, null; Insert Into App_User Values (" Bill "," 111 "," Billgates "," Billgates@sina.com ", NULL, NULL, NULL); ============================ ====================
Modify hibernate.cfg.xml and hibernate.properties, remove annotations, establish database coupons, including IP addresses, database names, user names, passwords.
But the JCS or incorrect report: Warning: Could not find value for key jcs.auxiliary.DC2005-1-13 19:24:55 org.apache.jcs.engine.control.CompositeCacheConfigurator parseAuxiliary serious: Could not instantiate auxFactory named "DC". 2005-1-13 19:24:55 net.sf.hibernate.cfg.configuration configure
JCS is a Java cache system that allows the system to read and write database speeds. Because this is a simple example, there will be no big load, and JCS has been replaced by other Java cache systems in Hibernate3beta1. So I will comment all
I found the following questions during my experiment: 1. Login.jsp can not log in even if the password is pair, always displays the login interface. Increase several records of all tables, can't. Finally, according to its program DispatchPowerAction.java and PowerAction.java, you must add a dingyd account in the database app_user table, and use dingyd to log in.
2. You need to set the table primary key Primary Key (ID), and self-enhanced auto_increment.