0
嗨,我們有一個運行Hibernate的服務器,類用envers進行審計。 像這樣:Java Hibernate Envers UpdateLockingStrategy警告HHH000416 On AuditTable
package db.shared;
import interfaces.GuiEditableTable;
import interfaces.ListableEntity;
import interfaces.ShortDescriptable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.envers.AuditTable;
import org.hibernate.envers.Audited;
import common.Identifiable;
import common.Preferences;
import common.entity.EntityConcurrency;
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Audited
@AuditTable(schema=Preferences.SCHEMA_AUDIT, value=Lizenz.CLASS_NAME+Preferences.AUDIT_SUFFIX)
@Table(schema = Preferences.SCHEMA_SHARED, uniqueConstraints = { @UniqueConstraint(columnNames = { Lizenz.PROPERTY_LIZENZ_NAME }), @UniqueConstraint(columnNames = { Lizenz.PROPERTY_LIZENZ_NUMBER }) })
public class Lizenz extends common.entity.AbstractEntity
implements EntityConcurrency, ListableEntity, ShortDescriptable, GuiEditableTable
{
private static final long serialVersionUID = 589201271279697573L;
public static final String CLASS_NAME = "Lizenz";
public static final String PROPERTY_LIZENZ_NAME = "lizenzName";
public static final String PROPERTY_LIZENZ_NUMBER = "lizenzNummer";
public static final String MTM_PROPERTY_NAME = "lizenz";
public static final int LIZENZ_NUMBER_PADDING = 4;
@Id
@Column(name = Identifiable.PROPERTY_ID, columnDefinition = Preferences.DDL_TYPE_ID)
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long ID;
@Version @Column(name = EntityConcurrency.PROPERTY_VERSION)
private long version;
private String lizenzName;
private String logo;
.
.
.
}
在serverstart有警告這樣的:
15:14:49 WARN [org.hibernate.dialect.lock.UpdateLockingStrategy] HHH000416: Write locks via update not supported for non-versioned entities [db.shared.Lizenz_AUD]
15:14:49 WARN [org.hibernate.dialect.lock.UpdateLockingStrategy] HHH000416: Write locks via update not supported for non-versioned entities [db.shared.Lizenz_AUD]
15:14:49 WARN [org.hibernate.dialect.lock.UpdateLockingStrategy] HHH000416: Write locks via update not supported for non-versioned entities [db.shared.Lizenz_AUD]
15:14:49 WARN [org.hibernate.dialect.lock.PessimisticReadUpdateLockingStrategy] HHH000416: Write locks via update not supported for non-versioned entities [db.shared.Lizenz_AUD]
15:14:49 WARN [org.hibernate.dialect.lock.PessimisticWriteUpdateLockingStrategy] HHH000416: Write locks via update not supported for non-versioned entities [db.shared.Lizenz_AUD]
的問題是,我們只是創建了DB-表的審覈,我們沒有任何Audit-類。類將在啓動時生成,並且我們還沒有找到任何@ audit-Options來禁止這些警告。警告與我們無關,因爲一次只寫入一次審計記錄並且永遠不會更新它,每個班級有5個警告正在淹沒我們的日誌。
我們在java 1.7中使用hibernate-envers-4.1.10.Final.jar和hibernate-core-4.1.10.Final.jar。
有沒有人有同樣的問題或知道如何解決它。 我們很感激任何幫助。
問題是如何做到這一點,因爲我們沒有審計對象只有表。該對象由Hibernate.Envers在啓動時生成。 –