makePersistent is not working
but findById is working. What's wrong?
Code:
<%!
ItemDao itDao = new ItemDao();
Item it = new Item();
%>
<%
it.setBonusataque(1);
it.setBonusdefesa(1);
it.setNome("Staff of Shaman");
itDao.makePersistent(it);
itDao.flush();
%>
Code:
package Model;
import java.io.Serializable;
import javax.persistence.*;
@SequenceGenerator(name="seqItem",sequenceName="item_id_seq",initialValue=1)
@Table(name = "item")
@Entity
public class Item implements Serializable
{
@Id
@GeneratedValue(generator="seqItem", strategy=GenerationType.AUTO)
@Column(name="id")
private int id;
@Column(name="bonusataque", nullable=true, length=4)
private int bonusataque;
@Column(name="bonusdefesa", nullable=true, length=4)
private int bonusdefesa;
@Column(name="nome", nullable=true, length=200)
private String nome;
...