Como adicionar mais campos iNTEIROS?

0 respostas
juniorsatanas

alguem sabe como se adiciona mais 1 campo Integer, para eu fazer calculo com ele ?

package org.vraptor.mydvds.model;

import java.util.Set;

import javax.persistence.Entity;

import javax.persistence.EnumType;

import javax.persistence.Enumerated;

import javax.persistence.GeneratedValue;

import javax.persistence.Id;

import javax.persistence.ManyToMany;

/**

  • Entidade Dvd.

  • A classe representa a tabela dvd no banco de dados.

  • Um objeto persistido dessa classe representa um registro no banco de dados.
    */
    @Entity
    public class Dvd {

    /*

    • Chave primária.
      */
      @Id
      @GeneratedValue
      private Long id; /id da tabela/

    private String title; /ampo titulo da tabela/

    private String description; /campo descricao da tabela/

    private String quantidade;           /* &lt--- campo adicionado por mim*/
    
    //Mapeamento entre dvd e usuario
    
    @ManyToMany(mappedBy = "dvds")
    
    private Set<User> users;
    

    @Enumerated(EnumType.STRING)
    private DvdType type;

    public String getDescription() {
    
    return description;
    
    }
    
    public void setDescription(String description) {
    
    this.description = description;
    
    }
    
    public Long getId() {
    
    return id;
    
    }
    
    public void setId(Long id) {
    
    this.id = id;
    
    }
    
    public String getTitle() {
    
    return title;
    
    }
    
    public void setTitle(String title) {
    
    this.title = title;
    
    }
    
    public DvdType getType() {
    
    return type;
    
    }
    
    public void setType(DvdType type) {
    
    this.type = type;
    
    }
    
    public String getQuantidade() {
    
    return quantidade;
    
    }
    
    public void setQuantidade(String quantidade) {
    
    this.quantidade = quantidade;
    
    }
    

    /**

    • @return the users
      */
      public Set<User> getUsers() {
      return users;
      }

    /**

    • @param users
    • the users to set
      
    */
    
    public void setUsers(Set<User> users) {
    
    this.users = users;
    
    }
    
    <a class="mention" href="/u/override">@Override</a>
    
    public boolean equals(Object obj) {
    
    return obj instanceof Dvd
    
    && getId().equals(((Dvd) obj).getId());
    
    }
    
    <a class="mention" href="/u/override">@Override</a>
    
    public int hashCode() {
    
    if (this.id == null) {
    
    return 0;
    
    }
    
    return this.id.hashCode() * 31;
    
    }
    

}

Criado 24 de junho de 2007
Respostas 0
Participantes 1