本文整理了Java中javax.persistence.Temporal
类的一些代码示例,展示了Temporal
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Temporal
类的具体详情如下:
包路径:javax.persistence.Temporal
类名称:Temporal
暂无
代码示例来源:origin: spring-projects/spring-data-examples
/**
* @author Oliver Gierke
*/
@Entity
public class Account {
@Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id;
@ManyToOne private Customer customer;
@Temporal(TemporalType.DATE) private Date expiryDate;
public Long getId() {
return id;
}
public Customer getCustomer() {
return customer;
}
public Date getExpiryDate() {
return expiryDate;
}
}
代码示例来源:origin: querydsl/querydsl
@Override
public void inspect(Element element, Annotations annotations) {
Temporal temporal = element.getAnnotation(Temporal.class);
if (temporal != null && element.getAnnotation(ElementCollection.class) == null) {
PropertyType propertyType = null;
switch (temporal.value()) {
case DATE: propertyType = PropertyType.DATE; break;
case TIME: propertyType = PropertyType.TIME; break;
case TIMESTAMP: propertyType = PropertyType.DATETIME;
}
annotations.addAnnotation(new QueryTypeImpl(propertyType));
}
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* @author Emmanuel Bernard
*/
@Entity
public class FinancialHistory implements Serializable {
@Id
//@JoinColumn(name = "FK")
@ManyToOne
Person patient;
@Temporal(TemporalType.DATE)
Date lastUpdate;
public FinancialHistory() {
}
public FinancialHistory(Person patient) {
this.patient = patient;
}
}
代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server
/**
* @return the createdAt
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name="created_at")
public Date getCreatedAt() {
return createdAt;
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* @author Emmanuel Bernard
*/
@Entity
@AssociationOverrides({
@AssociationOverride(name = "id.channel", joinColumns = @JoinColumn(name = "chan_id", nullable = false)),
@AssociationOverride(name = "id.presenter", joinColumns = @JoinColumn(name = "presenter_name", nullable = false))})
public class TvMagazin {
@EmbeddedId
public TvMagazinPk id;
@Temporal(TemporalType.TIME)
@Column(name="`time`")
Date time;
}
代码示例来源:origin: hibernate/hibernate-orm
@MappedSuperclass
public static class DBObject {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq")
protected Integer id;
@Temporal(TemporalType.TIMESTAMP)
protected Date correctDate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getCorrectDate() {
return correctDate;
}
public void setCorrectDate(Date correctDate) {
this.correctDate = correctDate;
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Temporal(TemporalType.TIMESTAMP )
public Date getFulfilled() {
return fulfilled;
}
代码示例来源:origin: apache/cloudstack
GeneratedValue gv = field.getAnnotation(GeneratedValue.class);
if (gv != null) {
if (gv.strategy() == GenerationType.IDENTITY) {
flags = Flag.DbGenerated.setTrue(flags);
} else if (gv.strategy() == GenerationType.SEQUENCE) {
assert (false) : "Sequence generation not supported.";
flags = Flag.DaoGenerated.setTrue(flags);
flags = Flag.Insertable.setTrue(flags);
flags = Flag.SequenceGV.setTrue(flags);
} else if (gv.strategy() == GenerationType.TABLE) {
flags = Flag.DaoGenerated.setTrue(flags);
flags = Flag.Insertable.setTrue(flags);
if (column == null || (column.insertable() && column.table().length() == 0)) {
flags = Flag.Insertable.setTrue(flags);
if (column == null || (column.updatable() && column.table().length() == 0)) {
flags = Flag.Updatable.setTrue(flags);
if (temporal.value() == TemporalType.DATE) {
flags = Flag.Date.setTrue(flags);
} else if (temporal.value() == TemporalType.TIME) {
flags = Flag.Time.setTrue(flags);
} else if (temporal.value() == TemporalType.TIMESTAMP) {
flags = Flag.TimeStamp.setTrue(flags);
代码示例来源:origin: hibernate/hibernate-orm
/**
* @author Emmanuel Bernard
*/
@Entity
public class MedicalHistory implements Serializable {
@Id
@JoinColumn(name = "FK")
@OneToOne
Person patient;
@Temporal(TemporalType.DATE)
Date lastupdate;
public MedicalHistory() {
}
public MedicalHistory(Person patient) {
this.patient = patient;
}
}
代码示例来源:origin: kiegroup/jbpm
@Column(name="ERROR_DATE")
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
@Override
public Date getErrorDate() {
return super.getErrorDate();
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* @author Chandra Patni
*/
@Entity
@SecondaryTable( name = "TV_PROGRAM_EXT", pkJoinColumns = {
@PrimaryKeyJoinColumn( name = "CHANNEL_ID" ),
@PrimaryKeyJoinColumn( name = "PRESENTER_NAME" )
} )
@AssociationOverrides({
@AssociationOverride(name = "id.channel", joinColumns = @JoinColumn(name = "chan_id", nullable = false)),
@AssociationOverride(name = "id.presenter", joinColumns = @JoinColumn(name = "presenter_name", nullable = false))})
public class TvProgram {
@EmbeddedId
public TvMagazinPk id;
@Temporal( TemporalType.TIME )
@Column(name="`time`")
Date time;
@Column( name = "TXT", table = "TV_PROGRAM_EXT" )
public String text;
}
代码示例来源:origin: hibernate/hibernate-orm
@Temporal(TemporalType.TIMESTAMP)
public Calendar getAlternativeDepartureDate() {
return alternativeDepartureDate;
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity
@Table( name = "PROC_ITEM" )
public static class Item {
@Id
private Integer id;
private String stockCode;
private String name;
private BigDecimal unitCost;
@Temporal( TemporalType.TIMESTAMP )
private Date availabilityStartDate;
@Temporal( TemporalType.TIMESTAMP )
private Date availabilityEndDate;
}
代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server
@Override
@Basic
@Temporal(javax.persistence.TemporalType.TIMESTAMP)
@Column(name = "expiration")
public Date getExpiration() {
return expiration;
}
代码示例来源:origin: hibernate/hibernate-orm
@Temporal(TemporalType.TIMESTAMP )
public Date getPlaced() {
return placed;
}
代码示例来源:origin: hibernate/hibernate-orm
private TemporalType getTemporalType(XProperty property) {
if ( key ) {
MapKeyTemporal ann = property.getAnnotation( MapKeyTemporal.class );
return ann.value();
}
else {
Temporal ann = property.getAnnotation( Temporal.class );
return ann.value();
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Entity( name = "Person" )
@Table( name = "person" )
public static class Person {
@Id
public Integer id;
String name;
@Temporal( TemporalType.DATE )
Date dob;
}
代码示例来源:origin: mitreid-connect/OpenID-Connect-Java-Spring-Server
/**
* @return the expiration
*/
@Basic
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "expiration")
public Date getExpiration() {
return expiration;
}
代码示例来源:origin: hibernate/hibernate-orm
@Basic
@Temporal(TemporalType.DATE)
public Date getDepartureDate() {
return departureDate;
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
field.setAccessible(true);
try {
if (TemporalType.TIMESTAMP.equals(temporalAnnotation.value()) && (field.isAnnotationPresent(AutoPopulate.class))) {
if (field.get(entity) == null || field.getAnnotation(AutoPopulate.class).autoUpdateValue()) {
if (type.isAssignableFrom(Date.class)) {
内容来源于网络,如有侵权,请联系作者删除!