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: entity is not persisted, but no exceptions
PostPosted: Wed Apr 10, 2013 11:18 pm 
Newbie

Joined: Wed Apr 10, 2013 10:58 pm
Posts: 1
Hello
I have simple example of hibernate /jpa but not ablr to make it work. I do not get any exceptions in the log but the enetity is not saved
I see the hibernate logging but not sure how to also add jpa logging in log4j.xml
here is what I have in persitance.xml


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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/persistence_2_0.xsd">

<persistence-unit name="myunit" transaction-type="RESOURCE_LOCAL">

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<class>com.follett.efollett.coursetrack.ftp.domain.dto.Title</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>

<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="root"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>


here is my code
Title title= new Title();
title.setTitle("abc");
title.setMaterialId("abcde");
title.setAuthor("a");


EntityManagerFactory emf = Persistence.createEntityManagerFactory("myunit");
EntityManager manager = emf.createEntityManager();
manager.persist(title);


I am using java.persistance annotations in Title so I do not have a mapping file, the Title class has the default contructor
also, the table is created in my sql test database but it has no priary key.

I would really appreciate your help


Top
 Profile  
 
 Post subject: Re: entity is not persisted, but no exceptions
PostPosted: Thu Apr 11, 2013 1:24 am 
Regular
Regular

Joined: Wed Apr 10, 2013 1:02 am
Posts: 50
I don't see any commits.. is it missing

_________________
Regards
Akash Miital
http://akash.thegrassroots.co.in/hibernate/


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.