Erros de settes

8 respostas
A

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.

PropertyNotFoundException: Could not find a setter for property id class aluno

8 Respostas

andrik

ele está informando que não encontrou um método setId na classe aluno

[]'s

A

as minhas classes são essas:

public class Aluno extends Pessoa {

private String matricula;

private Set turmas = new HashSet();

public Aluno() {}       

public void setMatricula(String matricula){this.matricula = matricula;}
public void SetTurmas(Set turmas){this.turmas = turmas;}


public String getMatricula(){return this.matricula;}
public Set getTurmas(){return this.turmas;}

}
<?xml version="1.0" encoding="UTF-8"?>
<key column="Pessoa_id"/>

  <property name="matricula"/>

  <set name="turmas"
         table="Turma_has_Aluno"
         inverse="true">

        <key column="Turma_id"/>
        <many-to-many class="Turma"/>

  </set>
leosouzabh

O que contem na sua classe Pessoa??

A

/*

  • Pessoa.java
  • Created on 4 de Fevereiro de 2006, 17:26
    */

/**
*

  • @author André
    
    */
    
    public class Pessoa {
    
    private String nome;
    
    private String email;
    
    private String telefone;
    
    private Endereco endereco;
    
    private int id;
    

    public Pessoa(){}/** Creates a new instance of Pessoa */

    public void setNome(String nome){this.nome = nome;}
    
    public void setEmail(String email){this.email = email;}
    
    public void setTelefone(String telefone){this.telefone = telefone;}
    
    public void setEndereco(Endereco endereco){this.endereco = endereco;}
    
    public void seId(int id){this.id= id;}
    
    public String getNome(){return nome;}
    
    public String getEmail(){return email;}
    
    public String getTelefone(){return telefone;}
    
    public Endereco getEndereco(){return endereco;}
    
    public int getId(){return id;}
    

}

andrik

na sua classe Pessoa existe o método seId, troca pra setId

[]'s

A

Obrigado, não tinha visto.

A

Eu também estou com dúvida se o meu banco está certo:
Create database banco;

Create table endereço(
Pessoa_id integer not null,
Rua varchar(255) not null,
Numero integer not null,
Bairro varchar(255) not null,
Estado varchar(255) not null,
Complemento text not null,
Cep varchar(255) not null,
Cidade varchar(255) not null,

Foreign key(Pessoa_id) references pessoa);

Create table pessoa(
Id integer not null,
Nome varchar(255) not null,
Email varchar(255) not null,
Telefone varchar(225) not null,

Primary key (id));

Create table professor(
Pessoa_id integer not null,
Titulo varchar(255) not null,

Foreign key(Pessoa_id) references pessoa);

Create table aluno(
Pessoa_id integer not null,
Matricula varchar(255) not null,

Foreign key(Pessoa_id) references pessoa);

Create table turma_has_aluno(
Turma_id integer not null,
Aluno_Pessoa_id integer not null,

Foreign key(Turma_id) references turma,
Foreign key(Aluno_Pessoa_id) references aluno);

Create table turma(
Id integer not null,
Disciplina_id integer not null,
Professor_Pessoa_id integer not null,
Nome varchar(255) not null,

Primary key(id),
Foreign key(Disciplina_id) references disciplina,
Foreign key(Professor_Pessoa_id) references professor);

Create table disciplina (
Id integer not null,
Curso_id integer not null,
Nome varchar(255) not null,
Ementa text not null,

Primary key (id),
Foreign key (Curso_id) references curso);

Create table curso(
Id integer not null,
Nome varchar(255) not null,
Descricao text not null,

Primary key(id));
Luca

Olá

O que seriam estes tais de settes?

[]s
Luca

Criado 19 de julho de 2006
Ultima resposta 19 de jul. de 2006
Respostas 8
Participantes 4