My question is pretty simple… i need to use a custom “SQLInsert” at some point in my code because i need to ignore duplicates.
Does “SQLInsert” breaks the automatic hibernate batching of entities getting saved/updated ? Or do they get batched normally ?
A little example of my entity i need to save
Would be glad for any help on this question
/**
* Represents a ID of a {@link com.artemis.Entity} which is unique for each entity and mostly the database id
*/
@Entity
@Table(name = "identity")
@Access(AccessType.FIELD)
@SQLInsert(sql = "insert into identity(tag, typeID, id) values(?,?,?) ON DUPLICATE KEY UPDATE id = VALUES(id), tag = values(tag), typeID = values(typeID)")
@SelectBeforeUpdate(value = false)
public class Identity extends Component {
@Id
public long id;
public String tag;
public short typeID;
public Identity() {}
public Identity(long id, String tag, short typeID) { this.id = id;this.tag = tag;this.typeID = typeID; }
}