Ajuda Hibernate por favor

2 respostas
Henrique_Fernandes

Bom dia a todos, por favor pessoal to com uma duvida no hibernate que eh o seguinte, segue o codigo:

import javax.*;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Transient;

import org.hibernate.annotations.Entity;
import org.hibernate.annotations.Table;


@Entity
@Table(name="tb_cliente")  //AQUI O ERRO
public class Cliente {

	
	@Id
	@Column(name="cpf")
	private String cpf;
	
	@Column(name = "nome")
	private String nome;
	
	@Transient
	private Endereco endereco;

	public Cliente(String newCpf, String newNome) {

		this.cpf = newCpf;
		this.nome = newNome;
		this.endereco = null;
	}
		
	public Cliente(String newCpf, String newNome, Endereco endereco) {

		this.cpf = newCpf;
		this.nome = newNome;
		this.endereco = endereco;
	}
	
	public String getCpf() {

		return cpf;
	}
	
	public String getNome() {

		return nome;
	}
	
	public Endereco getEndereco() {
		return endereco;
	}
	
	public void setCpf(String newCpf) {

		cpf = newCpf;
	}
	
	public void setNome(String newNome) {

		nome = newNome;
	}
	
	public void setEndereco(Endereco endereco) {
		this.endereco = endereco;
	}
}

O erro q aparece na minha @Table(name=“tb_cliente”)
- The annotation @Table must define the attribute appliesTo
- The attribute name is undefined for the annotation type Table

e nao sei como resolver isso.

Agradeço demais pela ajuda de todos, forte abraço!!!

2 Respostas

cristiano.andrade

use

import javax.persistence.Table;
import javax.persistence.Entity

ao invés de

import org.hibernate.annotations.Entity;  
import org.hibernate.annotations.Table;
Henrique_Fernandes

Pow cara brigadao mesmo isso resolveu o meu problema…

Grande abraço!!

Criado 13 de março de 2009
Ultima resposta 13 de mar. de 2009
Respostas 2
Participantes 2