Duvida iniciante ..JPA com HIbernate?

1 resposta
P

Olá,

duvida pois estou acostumado usar DAO e agora estou usando Hibernate OU JPA?

Essa é minha duvida pois estou em um projeto em que falaram que ia usar Hibernate

mas pelas classes que estou usando o import é feito em javax.persistence

e o persistence.xml tem variaveis usando HIbernate…

Essas são minhas duvidas :

  • estou usando Hibernate ou JPA ou ambos ???

  • no mercado qual outro framework de persistencia existe ???

{code]

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.GenerationType;

import <a href="http://javax.persistence.Id">javax.persistence.Id</a>;

import javax.persistence.Table;

/**
*

*/

@Entity

@Table(name = "Usuario")

public class Usuario {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

@Column
private String login;

@Column
private String password;

@Column

private String nome;

/*
 * Gets e Sets
 */
public Integer getId() {
	return id;

<hr>
<?xml version=“1.0” encoding=“UTF-8”?>

<persistence version=“1.0” xmlns=“<a href="http://java.sun.com/xml/ns/persistence">http://java.sun.com/xml/ns/persistence</a> xmlns:xsi=“<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a> xsi:schemaLocation=“<a href="http://java.sun.com/xml/ns/persistence">http://java.sun.com/xml/ns/persistence</a> <a href="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd</a>”>

<persistence-unit name=“UM”>
            &lt;description&gt;
                     Persistência usando JPA. 
            &lt;/description&gt;
            &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt;
            &lt;class&gt;quatro.Pessoa&lt;/class&gt;
            &lt;class&gt;quatro.Endereco&lt;/class&gt;
            &lt;properties&gt;
                    &lt;property name="hibernate.archive.autodetetion" value="class"/&gt;
                    &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" /&gt;
                    &lt;property name="hibernate.connection.driver_class"  value="com.mysql.jdbc.Driver" /&gt;
                    &lt;property name="hibernate.connection.username" value="root" /&gt;
                    &lt;property name="hibernate.connection.password" value="root" /&gt;
                    &lt;property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/um" /&gt;
                    &lt;property name="hibernate.show_sql" value="true" /&gt;  
                    &lt;!-- property name="hibernate.hbm2ddl.auto" value="create" /--&gt;     
                    &lt;property name="hibernate.format_sql" value="true" /&gt;   
                                   
            &lt;/properties&gt;
    &lt;/persistence-unit&gt;

</persistence>

1 Resposta

ignacio83

Vc está utilizando a implementação do Hibernate para o JPA. (http://www.hibernate.org/397.html)

JPA é apenas uma especificação que pode ser implementada por diferentes empresas.

Criado 2 de dezembro de 2008
Ultima resposta 2 de dez. de 2008
Respostas 1
Participantes 2