This content has been marked as final.
Show 4 replies
-
1. Re: Problems with JPA/Hibernate persist
jharby1 Nov 25, 2008 5:05 PM (in response to jharby1)P.S. I'm using Intellij's ORM generator to create the entity - here is the generated code for that:
package com.csatp.model; import javax.persistence.*; import java.sql.Timestamp; @Entity @Table(catalog = "WeekOld", schema = "dbo", name = "RECORDLOCK") public class RecordlockEntity { private int recordlockseqno; @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name = "recordlockseqno", nullable = false, length = 10) public int getRecordlockseqno() { return recordlockseqno; } public void setRecordlockseqno(int recordlockseqno) { this.recordlockseqno = recordlockseqno; } private String username; @Basic @Column(name = "username", nullable = false, length = 10) public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } private Timestamp lockdate; @Basic @Column(name = "lockdate", nullable = false, length = 23, precision = 3) public Timestamp getLockdate() { return lockdate; } public void setLockdate(Timestamp lockdate) { this.lockdate = lockdate; } private Timestamp expirationdate; @Basic @Column(name = "expirationdate", length = 23, precision = 3) public Timestamp getExpirationdate() { return expirationdate; } public void setExpirationdate(Timestamp expirationdate) { this.expirationdate = expirationdate; } private String recordkey; @Basic @Column(name = "recordkey", nullable = false, length = 30) public String getRecordkey() { return recordkey; } public void setRecordkey(String recordkey) { this.recordkey = recordkey; } private String recordtype; @Basic @Column(name = "recordtype", nullable = false, length = 10) public String getRecordtype() { return recordtype; } public void setRecordtype(String recordtype) { this.recordtype = recordtype; } public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RecordlockEntity that = (RecordlockEntity) o; if (recordlockseqno != that.recordlockseqno) return false; if (expirationdate != null ? !expirationdate.equals(that.expirationdate) : that.expirationdate != null) return false; if (lockdate != null ? !lockdate.equals(that.lockdate) : that.lockdate != null) return false; if (recordkey != null ? !recordkey.equals(that.recordkey) : that.recordkey != null) return false; if (recordtype != null ? !recordtype.equals(that.recordtype) : that.recordtype != null) return false; if (username != null ? !username.equals(that.username) : that.username != null) return false; return true; } public int hashCode() { int result; result = recordlockseqno; result = 31 * result + (username != null ? username.hashCode() : 0); result = 31 * result + (lockdate != null ? lockdate.hashCode() : 0); result = 31 * result + (expirationdate != null ? expirationdate.hashCode() : 0); result = 31 * result + (recordkey != null ? recordkey.hashCode() : 0); result = 31 * result + (recordtype != null ? recordtype.hashCode() : 0); return result; } }
-
2. Re: Problems with JPA/Hibernate persist
jharby1 Nov 25, 2008 5:54 PM (in response to jharby1)P.S.^2 - I found a way to get this to work by specifying the transaction attribute on the bean method to be NEVER and using the EntityManager Transactions. But is there a better way to do this? It seems like a hack as is.
-
3. Re: Problems with JPA/Hibernate persist
dgeraskov Nov 26, 2008 2:22 AM (in response to jharby1)Seems like your transaction never commited. Try to set for transaction autocommit to true. See documentation how to do this.
-
4. Re: Problems with JPA/Hibernate persist
jharby1 Nov 26, 2008 12:56 PM (in response to jharby1)Ok, thanks. It seems like relying on the container for Txns is not working possibly because I'm not using an entity bean but just an SLSB.
"dgeraskov" wrote:
Seems like your transaction never commited. Try to set for transaction autocommit to true. See documentation how to do this.