- 浏览: 71254 次
- 性别:
-
最新评论
文章列表
husband表结构:
wife表结构:
package com.bjsxt.hibernate;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
@Entity
pu ...
student表结构:
stuidcard表结构
package com.bjsxt.hibernate;
public class Student {
private int id;
private String name;
private int age;
private String sex;
private boolean good;
public boolean isGood() {
return good;
}
public void setGood(boolean good) {
this.good = good ...
husband表结构:
wife表结构
package com.bjsxt.hibernate;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
@Entity
public class Husband {
private int id;
private S ...
stuidcard表结构:
student表结构:
package com.bjsxt.hibernate;
public class Student {
private int id;
private String name;
private int age;
private String sex;
private boolean good;
private StuIdCard stuIdCard;
public StuIdCard getStuIdCard() {
return stuIdCard;
}
public v ...
husband表结构:
wife表结构
package com.bjsxt.hibernate;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
@Entity
public class Husband {
private int id;
private Str ...
stuidcard表结构:
student表结构:
package com.bjsxt.hibernate;
public class StuIdCard {
private int id;
private String num;
private Student student;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNum() {
return num;
}
public ...
package com.bjsxt.hibernate;
public enum Gender {
MALE, FEMALE
}
package com.bjsxt.hibernate;
import javax.persistence.Embeddable;
public class TeacherPK implements java.io.Serializable{
private int id;
private String name;
public int getId() {
return id;
}
public ...
package com.bjsxt.hibernate;
public class StudentPK implements java.io.Serializable{
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String n ...
package com.bjsxt.hibernate;
public enum Gender {
MALE, FEMALE
}
package com.bjsxt.hibernate;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Ta ...
<?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>
<ses ...
drop table test
create table test
(
id int primary key identity(1,1),
name varchar(20)
);
alter table test add clm_t1 nvarchar(20) null
alter table test drop column ['+@dateStr+']
select * from test;
declare @startYear int,@endYear int;
declare @startMonth int,@endMonth int
dec ...
Oracle不像Sqlserver,并没有提供l默认约束,但提供了默认值,效果一样。
1.在建表时设置默认约束:create table t1 (tname varchar2(20)
default 'yang');
2.为表添加默认约束:alter table t1 modify (tname varchar2(20) default 'yang');
先使字段col为空的都填上默认值 ‘0’:
update yourtable set col=0 where col is null
然后再col字段上加not null约束:
alter table yourtable modify column_name datatype not null;
Clob content = almanacBean.getContributionContent();
almanacBean.setContenteStr(content.getSubString(1, (int)content.length()));
Action 层以String传过来
DAO:
public TbAlmanacContribution savaTbAlmanacContribution(final TbAlmanacContribution tbAlmanacContribution)
2. {
3. H ...
oracle里面存放打字段的文本信息,一般采用clob字段,该字段以字符存放在数据库中
下面是如何用java读取clob里面的内容:
1.package com.data;
2.import java.io.BufferedReader;
3.import java.io.Reader;
4.import java.sql.Clob;
5.import java.sql.Connection;
6.import java.sql.DriverManager;
7.import java.sql.ResultSet;
8.import ...