Galera, ta dando esse erro aqui na minha aplicação, não faço ideia do que seja, começou quando eu acrescentei três campos que são de outra tabela no formulário…
Exception in thread "AWT-EventQueue-0" org.hibernate.PropertyAccessException: could not get a field value by reflection getter of br.inf.topsoft.Model.tab_parc.codparc
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:35)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3591)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3307)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:218)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:87)
at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1707)
at org.hibernate.loader.Loader.bindParameterValues(Loader.java:1678)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1563)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
at br.inf.topsoft.Dao.CadParcDao.getUnicoFunc(CadParcDao.java:126)
at br.inf.topsoft.Controller.CadParcCtrl.getUnicoFunc(CadParcCtrl.java:80)
at br.inf.topsoft.View.FrmLanParc.<init>(FrmLanParc.java:66)
at br.inf.topsoft.View.FrmCadParc.Alterar(FrmCadParc.java:41)
at br.inf.topsoft.Forms.FrmCadPrin.excluiActionPerformed(FrmCadPrin.java:219)
at br.inf.topsoft.Forms.FrmCadPrin.access$300(FrmCadPrin.java:14)
at br.inf.topsoft.Forms.FrmCadPrin$4.actionPerformed(FrmCadPrin.java:124)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6504)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6269)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4860)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2713)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Integer field br.inf.topsoft.Model.tab_parc.codparc to java.lang.Integer
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:55)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
at java.lang.reflect.Field.get(Field.java:372)
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:32)
... 62 more
Método Dao que eu chamo e o Netbeans afirma que está errado:
public tab_func getUnicoFunc(tab_parc asd) {
tab_func obj2;
Criteria filtro = session.createCriteria(tab_func.class);
filtro.add(Restrictions.eq("codparc", asd.getCodparc()));
obj2 = (tab_func) filtro.uniqueResult();
return obj2;
}
Esta é a Model do tab_parc
@Entity
@Table(name = "tab_parc")
public class tab_parc implements Serializable {
@Id
@GeneratedValue(generator = "seq_tabparc", strategy = GenerationType.SEQUENCE)
@SequenceGenerator(name = "seq_tabparc", sequenceName = "seq_tabparc")
@Column(unique = true, name = "codparc", updatable = false)
private Integer codparc;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "nasparc")
private Date nasparc; //Data de Nascimento
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "cadparc")
private Date cadparc; //Data de Cadastro
@Column(name = "nomparc")
private String nomparc; //Nome do Parceiro
@Column(name = "codfili")
private String codfili; //Filial
@Column(name = "cnpparc")
private String cnpparc; //CPF / CNPJ
@Column(name = "regparc")
private String regparc; //Segundo Documento
@Column(name = "obsparc")
private String obsparc; //Observações
@Column(name = "homparc")
private String homparc; //Home Page
@Column(name = "emaparc")
private String emaparc; //e-mail
@Column(name = "nacparc")
private String nacparc; //character varying(25); //Nacionalidade
@Column(name = "natparc")
private String natparc; //character varying(25); //Naturalidade
@Column(name = "ctpparc")
private String ctpparc; //character(15); //Carteira Profissional
@Column(name = "cnhparc")
private String cnhparc; //character(11); //Numero da CNH
@Column(name = "cat_cnh")
private String cat_cnh; //character varying(2); //Categoria da CNH
@Column(name = "estcivi")
private String estcivi; //character(2) DEFAULT 'IN'::bpchar; //Estado Civil
//@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@Column(name = "codocup")
private Integer codocup; //Código da Ocupação
@Column(name = "sexparc")
private Character sexparc; //character(1); //Sexo
@Column(name = "pesparc")
private Character pesparc; //character(1); //Tipo de Pessoa
@Column(name = "fgeparc")
private Short fgeparc; //smallint; //Ativo?
//getters e setters
}
E este é o Model do tab_func:
@Entity
@Table(name = "ponto.tab_func")
public class tab_func implements Serializable {
@Id
@GeneratedValue(generator = "ponto.seq_tabfunc", strategy = GenerationType.AUTO)
@SequenceGenerator(name = "ponto.seq_tabfunc", sequenceName = "ponto.seq_tabfunc")
@Column(unique = true, name = "codfunc", updatable = false)
private int codfunc;// integer NOT NULL
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity= br.inf.topsoft.Model.tab_parc.class)
@JoinColumn(name="codparc", referencedColumnName="codparc", nullable=false)
private tab_parc codparc;// integer NOT NULL
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity= br.inf.topsoft.Model.tab_sind.class)
@JoinColumn(name="codsind", referencedColumnName="codsind", nullable=false)
private tab_sind codsind;// integer NOT NULL
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity= br.inf.topsoft.Model.tab_ocup.class)
@JoinColumn(name="codocup", referencedColumnName="codocup", nullable=false)
private tab_ocup codocup;// integer NOT NULL
// Estes três campos abaixo foram os que eu adicionei no formulário
@Column(name = "sal_base")
private Float sal_base;// numeric(12,2)
@Column(name = "sal_tipo")
private Integer sal_tipo;// smallint, -- 1 - Mensalista 2 - Horista 3 - Diarista 4 - Comissinista
@Column(name = "carga_horaria")
private Float carga_horaria;// numeric(10,4)
//getters e setters
}
Então, se alguém puder me ajudar, ficarei grato. To a dois dias tentando resolver esse erro e nada.