一.DATE类型保存为时分秒
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UPDATE_TIME", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
取出来展示的时候用toLocalString就行了
二.增加临时字段
@Transient
三.主键table生成
@Id
@TableGenerator(name="GENERATOR_ID",table="PF_GENERATOR")
@GeneratedValue(strategy=GenerationType.TABLE, generator="GENERATOR_ID")
@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, precision = 10, scale = 0)
create table PF_GENERATOR
(
SEQUENCE_NAME VARCHAR2(40) primary key,
SEQUENCE_NEXT_HI_VALUE NUMBER(10)
)
表也要生成javaBean
四.删除分为两步
StCreditType ct = em.merge(creditType);
em.remove(ct);
五.操作数据库头部
@Transactional
public class CreditTypeServiceImpl implements CriditTypeService {
private EntityManager em;
@PersistenceContext
public void setEm(EntityManager em) {
this.em = em;
}