I can not save new object using JPA entity manager, please help

I am using Spring 3 with JPA to access database, I tried to persist object, but failed. This is what I do:
1) Config:
     <tx:annotation-driven transaction-manager="txManager" proxy-target-class="true"/>
     <bean id="txManager"
          class="org.springframework.orm.jpa.JpaTransactionManager">
          <property name="entityManagerFactory" ref="emf" />
     </bean>
     <bean id="emf"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
          <property name="dataSource" ref="dataSource" />
          <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
          <property name="loadTimeWeaver">
               <bean
                    class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
          </property>
          <property name="persistenceUnitName" value="memberPU"></property>
     </bean>
     <bean id="jpaVendorAdapter"
          class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
          <property name="database" value="MYSQL" />
          <property name="showSql" value="true" />
          <property name="generateDdl" value="false" />
          <property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
     </bean>
     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
          destroy-method="close">
          <property name="driverClassName" value="com.mysql.jdbc.Driver" />
          <property name="url"
               value="jdbc:mysql://localhost:3306/springinaction?createDatabaseIfNotExist\=true&amp;useUnicode\=true&amp;characterEncoding\=utf-8&amp;enableQueryTimeouts\=false" />
          <property name="username" value="root" />
          <property name="password" value="" />
          <property name="initialSize" value="5" />
          <property name="maxActive" value="10" />
     </bean>
2) Persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
     version="1.0">
     <persistence-unit name="memberPU" transaction-type="RESOURCE_LOCAL">
          <properties>
               <property name="hibernate.hbm2ddl.auto" value="validate" />
          </properties>
     </persistence-unit>
</persistence>
3) Domain:
@Entity
@Table(name = "members")
public class Spitter {
     @Id
     @Column(name = "id")
     @GeneratedValue(generator = "InvSeq")
     @SequenceGenerator(name = "InvSeq", sequenceName = "group table seq01", allocationSize = 5)
     private int id;
     @Column
     private String firstName;
     @Column
     private String lastName;
     @Column
     private int age;
gettters and setters...
4) Dao:
@Repository
@Transactional
public class SpitterDao {
     @PersistenceContext
     private EntityManager em;
public void addSpitter(Spitter spitter){
          Spitter s = new Spitter();
          //s.setId(null);
          s.setFirstName("Frank");
          s.setLastName("wqrewreqwr");
          s.setAge(45);
          System.out.print("Persisting into tDB here ");
          this.em.merge(s);
          this.em.persist(s);
          //this.em.flush();
          //this.em.getTransaction().commit();
If I do not call em.flush(), no error throws, and program is executed succesfully. BUT nothing is saved to DB. IF I used em.flush(), I got errormsg - "No Transaction", but the Dao is already annoted with @Transactional.
Reading through the JPA is no problem.
I tried different solutions heavily, but no result. Pleaes anyone point out what's the error and why object can not be serialized to DB.
Thanks very much

Hello,
You might try posting on a different forum (possibly a Spring forum) as this one is more specifically aimed at TopLink/EclipseLink which you are not using.
It appears the em is not associated to the transaction, but I can't suggest much other than point you at an EclipseLink Spring integration demo such as described here
http://www.vogella.de/java.html
or http://blog.springsource.org/2008/07/17/using-eclipselink-on-the-springsource-application-platform/
which might show settings that are missing or incorrect.
If you switched to using EclipseLink as the JPA provider i would suggest uploading the log file as that might detail how or why it is not being assocated to the transaction.
Best Regards,
Chris

Similar Messages

  • Can Not save new phone numbers

    Can Not save new phone numbers.
    I have :
    net_rim_bb_phone_app(66) corrupt message on the screen.
    Please advice.

    Hi, thanks for replying. However after doing this process I now get the error messages when I try to save. When I try to save to the SIM it says "SIM full cannot add contact" and when I try to save to the phone it says "error cannot save contact changes". I don't believe the SIM to be full as I only have 15 numbers on the SIM. Any other advice?

  • Have tried to restore settings due to problems, now Iphone shows Sim Failure, how can I get back to using my phone? Please help, its a business phone. :(

    Hi, I have tried to restore settings on my Iphone due to problems I was having with the phone cutting out when talking on the phone, now Iphone shows Sim Failure, how can I get back to using my phone? Please help, its a business phone.

    Hi jclarke64, 
    Thank you for contributing to the Apple Support Communities. 
    I'm sorry to hear that your iPhone 4s was lost, and glad that you were able to upgrade. 
    If your iPhone 4s was backed up to iCloud or using iTunes, you can restore the backed up data to your new phone. 
    See the steps in this article for help with restoring from a backup:
    Back up and restore your iPhone, iPad, or iPod touch using iCloud or iTunes - Apple Support
    All the best,
    Jeremy 

  • While taking photos my iphone's battery died, now my photos app won't open and I can't save any pictures taken or downloaded. Please help.

    While taking photos my iphone's battery died, now my photos app won't open and I can't save any pictures taken or downloaded. Please help.
    Also, I can't import my photos to my Windows 7 PC.

    Try rebooting your iPhone (holding the home button and sleep/wake button together until the apple logo appear)

  • I down loaded the update for 4 and when I get to the end where is you click finish, it tells me to close firefox, but I do not have it open. Now I can not get in to Firefox at all. PLEASE Help.

    I down loaded the update for 4 and when I get to the end where is you click finish, it tells me to close firefox, but I do not have it open. Now I can not get in to Firefox at all. PLEASE Help.

    You can get Firefox 3.6 from http://www.mozilla.com/en-US/firefox/all-older.html
    You should still have your profile folder, so when you install 3. you will get your bookmarks and other user data back.
    There is a third party version of Firefox that runs on OS X 10.4/10.5 and PPC Macs, for details see http://www.floodgap.com/software/tenfourfox

  • I will cancel the membership of each month. Please cancel. I can not English. Settlement became seen wrong. Please help soon

    I will cancel the membership of each month. Please cancel. I can not English. Settlement became seen wrong. Please help soon

    Cancel the Cloud http://forums.adobe.com/thread/1439535?tstart=0 may help
    or
    Adobe contact information - http://helpx.adobe.com/contact.html may help

  • Results for my browser has prob with 1st inch and harf from new babbilon crap will not hipolink i can not sign in or register on any thing please help

    results for my browser has prob with 1st inch and harf from new babbilon crap will not hipolink i can not sign in or register on any thing please help

    has anyone solve this problem? i upgraded my iphone 4 to 5.1.1 and now i can see only ""We're sorry, we are unable to continue with your activation at this time.  Please try again later, or contact customer care."
    i tried mani sim card, laptops, wifi. but for 7 days the problem is still exist....
    Please help me!!!

  • I am having problem with iphone 4s, I can not make calls or send text message? Please help.

    The problem is presistant. I tried to send the text message but it does not leave the phone, it is only delivered after I turn the phone off and then turn it on again. Only then it gets delivered and even that is only for that moment.
    Secondly, I can not send or recieve the calls as well.
    Thirdly, after I make a call, the calling screen gets stuck and I can not talk to the current caller or dial to another caller.
    Note: I have 'Not" dropped my iphone any where uptil now and I keep it in a pouch to protect it. The problem started recently and before that it worked fine. The problem started when I turned off the phone and after an hour or 2, I turned it on again.
    The signals of the service provider is coming perfectly. I haven't found any problem with there service yet.

    Network unavailable means the phone is detecting and using the SIM, else you would get a NO SIM error.
    It means that Sprint does not exist in the Ukraine (obvious), and Sprint does not have any interconnection agreement with a local carrier. Hence, the phone can't talk to anyone, carrier-wise. You need to get a SIM from a local carrier and try again. If it works, you're all set and the phone is indeed unlocked. Else you have been conned and will need to go and complain with whomever sold it to you.

  • I am trying to transfer the songs from my iPod touch to my computer and can not figure out how to do it. Please help me..

    I am trying to transfer songs from my iPod touch to my computer and can not figure out how to do it. I also want to transfer the songs I have back in to iTunes. My hard drive went out on my computer and I lost all of my songs, except for on my iPod. I have an iPhone as well and did an update and it wiped out all of my songs. Someone please help me.

    The music sync is one way - computer to ipod.  The only exception is itunes purchases.  Without syncing: File>Transfer Purchases
    It has always been very basic to always maintain a backup copy of your comptuer for just such an occasion.  use your backup copy to put everything back.

  • I can boot up my macbook pro but all i see is the wallpaper and the dock and the toolbar at the top. I can not see my hard drive or anything else. please help

    Please help. I can boot up my macbook pro and log in but after that all i see is the wallpaper, toolbar and the dock. In the dock it has 2 ? where the doc and download folders should be.  If I open up a new finder window it doesnt show anything in there no hard drive or anything. If anyone konws how to help let me know please and thank you.

    Agree with baltwo, though even if you have saved the install app I wouldn't use it unless its been used to install a known good copy of the OS already.
    In your case, that probably means start fresh:
    Restart the computer, holding down 'command' and 'r'. When the recovery disk window shows, choose 'Reinstall Mac OS X'.

  • TS3048 Wireless keyboard turns on but can not type.  Can not do any of the trouble shooting I read about because I can not type my password .... Please Help

    The Apple wireless keyboard will not work.  Batteries are new, light is on &amp; goes into search mode.  Worked fine yesterday, today - wont type.  Can not do any of the troubleshooting I read about online because I can not type my login.  Is there a lock key I may have hit by accident and can unlock?  The bluetooth is working because my wireless mouse works...Please Help

    I was just researching the same problem and found this info :
    "I figured it out, i had "mouse keys" on.
    To fix go to Preferences>Universal>Mouse> MouseKeys and click off"
    sure enough I had the 'mousekeys' on and turning it off - keyboard now working
    hope this works for you

  • HOW DO I UNINSTALL WINDOWS 8.1 PREVIEW FROM MACBOOK PRO (SNOW LEOPARD)... CAN NOT FIND README FILE FOR WINDOWS PREVIEW. PLEASE HELP

    how can i uninstall windows 8.1 preview from my macbook pro?? ive looked for over an hour for the readme file for the windows 8.1 preview and have had no luck. ive done almost everything i can think of at the moment and nothing is working. somebody please help, thanks

    Windows 8.1 Preview cannot be uninstalled. However, if what you want is to remove Windows completely, start up in OS X, open Boot Camp Assistant (in /Applications/Utilities) and follow the steps to remove the Windows partition.
    If what you want is to install the final Windows 8.1 version, read this Microsoft support article > http://windows.microsoft.com/en-us/windows-8/update-from-preview

  • Iphone 4 will not sync with itunes. I tunes will freeze when it says waiting for sync to start . I can not put any media on my device ! please help !!!

    Please help me figure out why my iphone 4 will not sync with itunes. I wish to prevent wiping the device clean if possible.
    thanks,
               Brian

    I have had exactly the same problem before, I have followed the guide as suggested to the letter and still no joy, each time (3 times now) that I have reinstalled the latest version of iTunes it is recognised and syncs with my iphone but with the next reboot of my computer it is gone again.
    Try to refer this article about [how to transfer iPhone contents to computer|http://www.softwarebbs.com/wiki/Howto_transer_or_backup_iPhone_contents_toPC].
    Hope it works you out.

  • I can not save webpages sometimes using Safari on macbook air OSx 10.9. What the **** is going on?

    Can you help me fix please?

    Welcome to Apple Support Communities
    MacBooks Pro with Retina display have not got an IR receiver, so you cannot use the Apple Remote with it

  • Can I save new bookmarks using Firefox to my imported IE Favorites List?

    I just installed Firefox as my browser and I imported my Favorites from IE. When I open the Bookmarks tab on Firefox I see my imported list at the bottom of the drop down. When I find something new to Bookmark, how do I get it to go into my previously established favorites list that was imported from IE? This list is extensive and itemized. Do I have to resave each and every one of my previous IE favorites to get the old and new on only one list? I sure don't want to have to work between two lists of Favorites / Bookmarks. Dan

    You can move the favorites in the "From Internet Explorer" to another bookmarks folder or leave them there.<br />
    If you click the star in the location bar to bookmark a link then you can click the yellow star a second time to open the "Edit this bookmark" dialog and move a bookmark to another folder.
    See also http://kb.mozillazine.org/Sorting_and_rearranging_bookmarks_-_Firefox

Maybe you are looking for

  • Importing swf from bin-release to Flash Professional..

    Hello, I'm trying to take a .swf from the bin-release folder from Flash Builder and import it into Flash Professional CS5 and it doesn't work. Here are the steps I have taken: I'm using the following simple code in FlashBulder <?xml version="1.0" enc

  • Multiple blocking locks on same object

    we have a database that is providing a great deal of application 'freezing' due to lock problems that were not experienced before moving to a new 10g database environment. one of the items i believe to be of interest is the fact that when this 'freez

  • Poor sound quality on podcasts after upgrading to leopard

    I upgraded my Powerbook G4 to Leopard yesterday. Currently, my podcasts from Bloomberg on the Econonmy are almost uninteligible as they skipp words, have static etc. Before the update, everything worked fine. Is this a compresssion issue? What can I

  • Passing multiple single values from R/3 BAPI to BW Query in VC

    Hi Experts I have a VC model where I am calling an R/3 BAPI which is returning a table of customer accounts.  I'm trying to go directly from that BAPI to a BW Query and pass the table of accounts into the BW Query. The BW Query has been set up with a

  • Unable to connect to internet on ALL computers

    I am having difficulties connecting to my wireless internet through my computer. When I select the network it comes up with a box asking me for my WEP password. Once I enter it, it says "Connection Timeout". This is happening to four different macboo