-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Data Not inserting into Database JPA+Hibernate
PostPosted: Fri Nov 05, 2010 5:51 am 
Newbie

Joined: Fri Nov 05, 2010 5:41 am
Posts: 2
Hi All,

I am new to JPA and Hibernate, these are my files:

this is my Entity class

Quote:
package com.ernst.persistenceImpl.beanImpl;

import javax.persistence.*;
import static javax.persistence.FetchType.LAZY;
import javax.jdo.annotations.Index;


@Entity
@Table(name = "ADRESSES")
public class AdressesBeanImpl {

@Id
@Index(name = "ix_adress_id")
private int adress_id;

@Basic
private String titel;

@Basic
private String vorname;

@Basic
private String nachnahme;

@Basic
private String position;

@Basic
private String tel;

@Basic
private String cell_phone;

@Basic
private String fax;

@Basic
private String email;

@Basic
private String website;

@Basic(fetch = LAZY)
@Lob
private byte[] zusatzinfo;

@Basic
private String adress_strasse;

public int getAdress_id() {
return adress_id;
}

public void setAdress_id(int adress_id) {
this.adress_id = adress_id;
}

public String getTitel() {
return titel;
}

public void setTitel(String titel) {
this.titel = titel;
}

public String getVorname() {
return vorname;
}

public void setVorname(String vorname) {
this.vorname = vorname;
}

public String getNachnahme() {
return nachnahme;
}

public void setNachnahme(String nachnahme) {
this.nachnahme = nachnahme;
}

public String getPosition() {
return position;
}

public void setPosition(String position) {
this.position = position;
}

public String getTel() {
return tel;
}

public void setTel(String tel) {
this.tel = tel;
}

public String getCell_phone() {
return cell_phone;
}

public void setCell_phone(String cell_phone) {
this.cell_phone = cell_phone;
}

public String getFax() {
return fax;
}

public void setFax(String fax) {
this.fax = fax;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getWebsite() {
return website;
}

public void setWebsite(String website) {
this.website = website;
}

public byte[] getZusatzinfo() {
return zusatzinfo;
}

public void setZusatzinfo(byte[] zusatzinfo) {
this.zusatzinfo = zusatzinfo;
}

public String getAdress_strasse() {
return adress_strasse;
}

public void setAdress_strasse(String adress_strasse) {
this.adress_strasse = adress_strasse;
}


persistence.xml file:

Quote:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd"
version="1.0">

<persistence-unit name="LagerstandDS" transaction-type="JTA">

<!-- The provider only needs to be set if you use several JPA providers
<provider>org.hibernate.ejb.HibernatePersistence</provider> -->

<jta-data-source>java:/LagerstandDS</jta-data-source>

<class>com.ernst.persistenceImpl.beanImpl.AdressesBeanImpl</class>

<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url" value="jdbc:mysql://127.0.0.1:3306/lagerstand"/>

<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="sekhar"/>

<!-- Scan for annotated classes and Hibernate mapping XML files -->
<property name="hibernate.archive.autodetection" value="class"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>

<!-- SQL stdout logging -->
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.show_sql" value="true"/>
<property name="use_sql_comments" value="true"/>
</properties>

</persistence-unit>
</persistence>


I have a pom.xml which is used to build my project and it builds perfectly and when I deploy in JBOSS, its saying schema was created and schema was updated..but I didnt find any data in the database, can any one please give me some suggestion and tell me whats wrong in the files.


Thanks in Advance,

Regards,
Raja.


Top
 Profile  
 
 Post subject: Re: Data Not inserting into Database JPA+Hibernate
PostPosted: Fri Nov 05, 2010 9:59 am 
Beginner
Beginner

Joined: Tue Oct 26, 2010 6:12 pm
Posts: 29
Please show us the code where you use this entity.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.