This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.Id; | |
@Entity | |
public class Usuario { | |
@Id | |
private Long id; | |
@Column | |
private String primeiroNome; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Usuario { | |
@Id | |
private Long id; | |
@Column | |
private String primeiroNome; | |
@Column | |
private String sobrenome; | |
@Transient | |
private Boolean atualizar; // não faça isso | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Usuario { | |
@Id | |
private Long id; | |
@Column | |
private String primeiroNome; | |
@Column | |
private String sobrenome; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Usuario { | |
@Id | |
private Long id; | |
@Column | |
private String primeiroNome; | |
@Column | |
private String sobrenome; | |
@Column | |
private String email; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CadastroUsuarioService { | |
public void cadastrarNovoUsuario(Usuario usuario) { | |
if (!usuario.getAceitouTermosDeUso()) { | |
// lança exceção de termos de uso | |
} | |
if (!usuario.getEmail().equals(usuario.getConfirmacaoEmail())) { | |
// lança exceção de emails diferentes | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CadastroUsuarioService { | |
public void cadastrarNovoUsuario(Usuario usuario, String confirmacaoEmail, Boolean aceitouTermosDeUso) { | |
if (!aceitouTermosDeUso) { | |
// lança exceção de termos de uso | |
} | |
if (!usuario.getEmail().equals(confirmacaoEmail)) { | |
// lança exceção de emails diferentes | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Usuario { | |
@Id | |
private Long id; | |
@Column | |
private String primeiroNome; | |
@Column | |
private String sobrenome; | |
@Column | |
private String email; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Usuario { | |
@Id | |
private Long id; | |
@Column | |
private String primeiroNome; | |
@Column | |
private String sobrenome; | |
@Column | |
private String email; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Usuario { | |
@Id | |
private Long id; | |
@Column | |
private String primeiroNome; | |
@Column | |
private String sobrenome; | |
@Column | |
private String email; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Usuario> recupereUsuarioComEnderecos(Long idUsuario) { | |
Usuario usuario = db.findById(idUsuario); | |
List<Endereco> enderecos = db.findByIdUsuario(idUsuario); | |
usuario.setEnderecos(enderecos); | |
return usuario; | |
} |
OlderNewer