Struts Problem Report
- May 04 Thu 2017 14:59
-
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role 解決方法
用 Hibernet Tool 自動產生的 Domain Code,對於 FOREIGN KEY 會以 annotation: @ManyToMany(fetch = FetchType.LAZY) 來作註,但執行時會發生下列的錯誤
Struts Problem Report
Struts Problem Report
- May 04 Thu 2017 08:54
-
JPA Error Code: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
作法如下:
http://stackoverflow.com/questions/26616723/java-lang-nosuchmethoderror-javax-persistence-table-indexesljavax-persistenc
http://stackoverflow.com/questions/26616723/java-lang-nosuchmethoderror-javax-persistence-table-indexesljavax-persistenc
- Feb 16 Thu 2017 17:15
-
JBoss EAP 6.4 設定連結 SQL Server 2016 Express
在目錄 %JBOSS_HOME%\modules\com\microsoft\sqlserver\jdbc\main 下放入 module.xml & sqljdbc42.jar。
module.xml 的內容
module.xml 的內容
- Feb 15 Wed 2017 16:12
-
Hibernate Config File for Sql Server Express / Oracle DB / MySQL
Sql Server Express
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=master;user=sa;password=password</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
</session-factory>
</hibernate-configuration>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=master;user=sa;password=password</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
</session-factory>
</hibernate-configuration>
- May 06 Fri 2016 16:39
-
Spring Data JPA - Transaction 在多個 multi-table 中作業時的控制
Step 01: 準備 table : TEST_GROUP & TEST_MEMBERS
table : TEST_GROUP
CREATE TABLE JAPPS.TEST_GROUP
(
ID VARCHAR2(10 BYTE),
NAME VARCHAR2(10 BYTE)
)
table : TEST_GROUP
(
ID VARCHAR2(10 BYTE),
NAME VARCHAR2(10 BYTE)
)
- Feb 18 Thu 2016 08:10
-
struts2 加入 struts2-spring-plugin 後的 Junit 的單元測試撰寫
當 struts2 加入 struts2-spring-plugin 的 JAR 檔後,執行 JUnit 或 Maven build 時發生
SEVERE: [50:59.081] ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
SEVERE: [50:59.089] Dispatcher initialization failed
Looks like the Spring listener was not configured for your web app!
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
SEVERE: [50:59.089] Dispatcher initialization failed
- Feb 17 Wed 2016 13:04
-
Spring Quartz Job Schedule Simple Example 工作排程器
配置:
Maven: pom.xml
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.2</version>
</dependency>
Maven: pom.xml
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz-jobs</artifactId>
<version>2.2.2</version>
</dependency>
- Jan 28 Thu 2016 08:31
-
Spring Data JPA 整合篇
看完 Spring Data JPA 基本篇 與 Spring Data JPA 進階篇 之後,再來看一下 Spring Data JPA 框架,它主要針對的就是 Spring 唯一沒有簡化到的業務邏輯代碼。接下來我們針對前面的例子進行改造,讓 Spring Data JPA 來幫助我們完成業務邏輯。在著手寫代碼之前,開發者需要先 下載Spring Data JPA 的發佈包(需要同時下載 Spring Data Commons 和 Spring Data JPA 兩個發佈包,Commons 是 Spring Data 的公共基礎包),並把相關的依賴 JAR 檔加入到 CLASSPATH 中。
- Jan 27 Wed 2016 15:10
-
Spring Data JPA 進階篇
在 Spring Data JPA 基本篇 談到 JPA 的基本作業,現在加入 Spring 的注入(Dependency Injection)來看,Spring 簡化程式碼有多少.
Step 01: DAO Interface: PersonSpringDataDao.java
package com.mis.demos.dao;
import com.mis.demos.model.Person;
public interface PersonSpringDataDao {
public Person Save(Person person);
}
Step 01: DAO Interface: PersonSpringDataDao.java
import com.mis.demos.model.Person;
public interface PersonSpringDataDao {
public Person Save(Person person);
}
- Jan 18 Mon 2016 09:06
-
Spring Data JPA 基本篇

本文的示例代碼基於 Hibernate EntityManager 開發,程式碼中使用到的都是 JPA 規範提供的Interface / Class,以便瞭解 JPA 基本的概念。整個系統架構如下
Step 01 : create mysql table: person
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`firstName` varchar(45) NOT NULL,
`lastName` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
1
