Pessoal.
Tenho a seguinte entidade.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.org.system4.MB;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
*
* @author rodrigo.klein
*/
@Entity
@Table(name = "CODE")
@NamedQueries({@NamedQuery(name = "Code.findById", query = "SELECT c FROM Code c WHERE c.id = :id"), @NamedQuery(name = "Code.findByIum", query = "SELECT c FROM Code c WHERE c.ium = :ium"), @NamedQuery(name = "Code.findByStatus", query = "SELECT c FROM Code c WHERE c.status = :status")})
public class Code implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="codeseqGen",sequenceName="code_seq",allocationSize=100)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="codeseqGen")
@Column(name = "ID", nullable = false)
private BigDecimal id;
@Column(name = "IUM", nullable = false)
private String ium;
@Column(name = "STATUS")
private String status;
@OneToMany(mappedBy = "codeid")
private Collection<Ium> iumCollection;
public Code() {
}
public Code(BigDecimal id) {
this.id = id;
}
public Code(BigDecimal id, String ium) {
this.id = id;
this.ium = ium;
}
public BigDecimal getId() {
return id;
}
public void setId(BigDecimal id) {
this.id = id;
}
public String getIum() {
return ium;
}
public void setIum(String ium) {
this.ium = ium;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Collection<Ium> getIumCollection() {
return iumCollection;
}
public void setIumCollection(Collection<Ium> iumCollection) {
this.iumCollection = iumCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Code)) {
return false;
}
Code other = (Code) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "br.org.system4.MB.Code[id=" + id + "]";
}
}
e quando faço a chamada pra persistir ela no banco, está me retornando o seguinte erro.
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: #{codeMB.gerar}: java.lang.RuntimeException: javax.persistence.EntityExistsException:
Exception Description: The sequence named [code_seq] is setup incorrectly. Its increment does not match its pre-allocation size.
root cause
javax.faces.FacesException: #{codeMB.gerar}: java.lang.RuntimeException: javax.persistence.EntityExistsException:
Exception Description: The sequence named [code_seq] is setup incorrectly. Its increment does not match its pre-allocation size.
root cause
javax.faces.el.EvaluationException: java.lang.RuntimeException: javax.persistence.EntityExistsException:
Exception Description: The sequence named [code_seq] is setup incorrectly. Its increment does not match its pre-allocation size.
root cause
java.lang.RuntimeException: javax.persistence.EntityExistsException:
Exception Description: The sequence named [code_seq] is setup incorrectly. Its increment does not match its pre-allocation size.
root cause
javax.persistence.EntityExistsException:
Exception Description: The sequence named [code_seq] is setup incorrectly. Its increment does not match its pre-allocation size.
root cause
Exception [TOPLINK-7027] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.ValidationException
Exception Description: The sequence named [code_seq] is setup incorrectly. Its increment does not match its pre-allocation size.
note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1_01 logs.
Estou começando agora com JPA e Annotation e isso ta me fritando os miolos.. rs 8) ..
A sequencia code_seq está criada dentro do Oracle direitinho....
Obrigado