Skip to content

Commit

Permalink
添加数据访问层和业务层。
Browse files Browse the repository at this point in the history
  • Loading branch information
houyi committed Oct 15, 2014
1 parent 3b6e48b commit 91d2832
Show file tree
Hide file tree
Showing 12 changed files with 726 additions and 7 deletions.
195 changes: 195 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>lottery</groupId>
<artifactId>lottery</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source />
<target />
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.181</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.10.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>4.5.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.2.Final</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>mchange-commons-java</artifactId>
<version>0.2.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.2.11.RELEASE</version>
</dependency>
</dependencies>
</project>
4 changes: 2 additions & 2 deletions src/com/lottery/Launcher.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.lottery;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
* Created by mmzz on 2014/10/4.
*/
public class Launcher {

public static void main(String[] args) {
@SuppressWarnings("resource")
public static void main(String[] args) {

String contextPath[] = new String[]{"applicationContext.xml"};
new ClassPathXmlApplicationContext(contextPath);
Expand Down
15 changes: 15 additions & 0 deletions src/com/lottery/dao/LotteryAllDao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.lottery.dao;

import org.springframework.stereotype.Repository;

import com.lottery.dao.hibernate3.SimpleHibernateDao;
import com.lottery.model.LotteryAny;

/**
* @author houyi
*
*/
@Repository
public class LotteryAllDao extends SimpleHibernateDao<LotteryAny, String> {

}
15 changes: 15 additions & 0 deletions src/com/lottery/dao/LotteryAnyDao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.lottery.dao;

import org.springframework.stereotype.Repository;

import com.lottery.dao.hibernate3.SimpleHibernateDao;
import com.lottery.model.LotteryAny;

/**
* @author houyi
*
*/
@Repository
public class LotteryAnyDao extends SimpleHibernateDao<LotteryAny, String> {

}
28 changes: 28 additions & 0 deletions src/com/lottery/dao/hibernate3/BussinessEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.lottery.dao.hibernate3;

import java.io.Serializable;
import java.lang.annotation.Annotation;

import javax.persistence.MappedSuperclass;
import javax.persistence.Table;

/**
*
* @author houyi
*
*/
@MappedSuperclass
public abstract class BussinessEntity extends IdEntity implements Serializable {

private static final long serialVersionUID = 8102619269019476594L;

public String getTableName() {
for (Annotation anno : this.getClass().getAnnotations()) {
if (anno.annotationType().equals(Table.class)) {
return ((Table) anno).name();
}
}
return null;
}

}
35 changes: 35 additions & 0 deletions src/com/lottery/dao/hibernate3/IdEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.lottery.dao.hibernate3;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

import org.hibernate.annotations.GenericGenerator;

/**
*
* @author houyi
*
*/
@MappedSuperclass
public abstract class IdEntity implements Serializable{

private static final long serialVersionUID = 8784608728898957320L;

@Id
@GenericGenerator(name = "generator", strategy = "uuid.hex")
@GeneratedValue(generator = "generator")
@Column(name = "ID", length=64)
private String id;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}
}
Loading

0 comments on commit 91d2832

Please sign in to comment.