従業員をはじめ、お客様や弊社を支えてくれている皆様のお陰です。本当にありがとうございます。
弊社は6月決算ですので、準備期間も入れてようやく丁度半年になろうか、というところでまだまだまだまだ・・・ですが、今後とも邁進して参ります。
・作成日
・更新日
・論理削除フラグ
@Embeddable
public class Basis implements Serializable
{
@Column(nullable = false)
@NotNull
private Date entry = new Date();
@Column(nullable = false)
@NotNull
private Date modify = new Date();
@Column(nullable = false)
@NotNull
private Boolean del = false;
}
@Embedded
private Basis basis = new Basis();
@Version
private Integer version_no;
User(Entity)=> ユーザ(テーブル名称)
name(Entity)=> ユーザ名称(カラム名称)
@Entity
@Table(name="ユーザ")
public class User implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "ユーザ名称", nullable = false)
@NotNull
@Length(max = 20)
private String name;
@Column(name = "パスワード", nullable = false)
@NotNull
@Length(max = 10)
private String passwd;
}
A(1) -------------------> B(*)
@Entity
public class A implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Version
private Integer version;
@OneToMany(mappedBy = "a", cascade = CascadeType.REMOVE)
private Set<B> bs;
}
@Entity
public class B implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Version
private Integer version;
@ManyToOne(optional = false)
@NotNull
private A a;
}
CREATE TABLE A
(
id bigserial NOT NULL,
"version" integer,
CONSTRAINT a_pkey PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
CREATE TABLE B
(
id bigserial NOT NULL,
"version" integer,
a_id bigint NOT NULL,
CONSTRAINT b_pkey PRIMARY KEY (id),
CONSTRAINT fk26f4fb2dbc3ce1 FOREIGN KEY (a_id)
REFERENCES a (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;