Below is the entity bean.
The app being executed is a load test. It inserts entities in one thread, then reads them (with createNativeQuery) in a second thread, then updates them (with merge) in a third thread.
Code:
@Entity
@Table( name = "msg_out" )
public class MsgOut implements Serializable {
private static final long serialVersionUID = 5505906394742402108L;
private long id;
private String content;
private int accountId;
private int outStateId;
private Timestamp timeScheduled;
private Timestamp timeInserted;
private Timestamp timeUpdated;
@Column( name = "account_id" )
public int getAccountId() {
return this.accountId;
}
public void setAccountId( int accountId ) {
this.accountId = accountId;
}
@Column
@Id
@GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "MsgOut_Id_seq" )
@SequenceGenerator( name = "MsgOut_Id_seq", sequenceName = "\"MsgOut_Id_seq\"" )
public long getId() {
return this.id;
}
public void setId( long id ) {
this.id = id;
}
@Column( name = "out_state_id" )
public int getOutStateId() {
return this.outStateId;
}
public void setOutStateId( int outStateId ) {
this.outStateId = outStateId;
}
@Column( name = "content" )
public String getContent() {
return this.content;
}
public void setContent( String content ) {
this.content = content;
}
@Column( name = "time_inserted" )
public Timestamp getTimeInserted() {
return this.timeInserted;
}
public void setTimeInserted( Timestamp timeInserted ) {
this.timeInserted = timeInserted;
}
@Column( name = "time_scheduled" )
public Timestamp getTimeScheduled() {
return this.timeScheduled;
}
public void setTimeScheduled( Timestamp timeScheduled ) {
this.timeScheduled = timeScheduled;
}
@Column( name = "time_updated" )
@Version
public Timestamp getTimeUpdated() {
return this.timeUpdated;
}
public void setTimeUpdated( Timestamp timeUpdated ) {
this.timeUpdated = timeUpdated;
}
}