<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="cataction" class="com.test.CatAction"> </bean> </beans>
自分で作ったり提供したりするものは、まず自分自身で使ってみろろということです。自分じゃ使わないものなら人はいくらでも無責任にも無思考にもなれる。そういう投げやりな「サービス」やら「プロダクツ」なんて、だれだってイヤだ。自分が作り手と同時に利用者の立場になれば、ちゃんと使えるレベルのものを提供しようとします。
2012年1月8日日曜日
Simple Spring Sample
testSpringBean.xml
2012年1月7日土曜日
xml簡単に解析する
XML文字列を簡単に解析して、読み取るサンプルです。
使用ライブラリ:Configuration
使用ライブラリ:Configuration
@Test
public void test01() throws ConfigurationException
{
String xmlcontent = "<root><name>helo xml.</name></root>";
StringReader xmlin = new StringReader(xmlcontent);
XMLConfiguration configuration = new XMLConfiguration();
configuration.load(xmlin);
assertEquals("helo xml.", configuration.getString("name"));
}
2012年1月5日木曜日
EclipseでJavadocをUTF-8で作成する
プロジェクトからExportをして、javadocを選んで、VM引数設定の画面で下記の内容を入力すれば、UTF-8のドキュメントを作成できる。
-encoding "utf-8" -charset "utf-8"
2012年1月2日月曜日
Hibernate EntityManager ManyToMany
一対多サンプル(Hibernate)
ポイント:
1、Joinテーブル:JOIN_DELEGATE_EVENT
2、EventとDelegateテーブル
ポイント:
1、Joinテーブル:JOIN_DELEGATE_EVENT
2、EventとDelegateテーブル
2012年1月1日日曜日
Hibernate EntityManager SecondaryTable
Hibernate Annotationで一つのクラスで二つのテーブルにマッピングする。
Customer.java
CustomerTest.java
テーブル
customer
customerdetail
Customer.java
CustomerTest.java
テーブル
customer
customerdetail
Hibernate EntityManager OneToMany
College.java
package com.test;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class College {
private int collegeId;
private String collegeName;
private List<CollegeStudent> students;
@Id
@GeneratedValue
public int getCollegeId() {
return collegeId;
}
public void setCollegeId(int collegeId) {
this.collegeId = collegeId;
}
public String getCollegeName() {
return collegeName;
}
public void setCollegeName(String collegeName) {
this.collegeName = collegeName;
}
@OneToMany(targetEntity = CollegeStudent.class, mappedBy = "college",
cascade = CascadeType.ALL, fetch = FetchType.EAGER)
public List<CollegeStudent> getStudents() {
return students;
}
public void setStudents(List<CollegeStudent> students) {
this.students = students;
}
}
Hibernate EntityManager 複合キー
Accounts.java
package com.test;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Accounts {
AccountsCompoundKey compoundKey;
private int accountBalance;
@Id
public AccountsCompoundKey getCompoundKey() {
return compoundKey;
}
public void setCompoundKey(AccountsCompoundKey compoundKey) {
this.compoundKey = compoundKey;
}
public int getAccountBalance() {
return accountBalance;
}
public void setAccountBalance(int accountBalance) {
this.accountBalance = accountBalance;
}
}
登録:
コメント (Atom)