Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Hibernate does not persist my database  RSS feed

 
Ranch Hand
Posts: 192
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Under Fedora 28 X86_64 server with Xfce4 for the desktop.
I am developing a Java EE application, with database h2. I imported the version 1.4.196 h2.jar, my base is under ~ / .m2 / repository / com / h2database / h2 / 1.4.196 /, because I use <Maven>.
I use JPQL from JPA and I persist my java objects with a source code that was tested.
My problem is that I can not write in my database H2 with hibernate, it should create two tables but nothing is done, maybe it comes from my configuration file persistence.xml:




Here is my pom.xml:
 
Philippe Ponceblanc
Ranch Hand
Posts: 192
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So,
i have forgot the transaction.begin()...

this is my debug of eclipse console output :

 
Bartender
Posts: 20356
111
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It says that your database userid and/or password are invalid.

I presume that your database is an in-memory instance, in which case you might not have defined it to have a userid/password. However, I've seen issues with JDBC drivers this way before.

I can't give you an exact answer, but you might want to check the H2 documentation and see if you can define a userid/password to match with properties coded in your HibernatePersistenceProvider. Or you might find that they have a different JDBC driver for in-memory instances (which I think is what Derby did).
 
Philippe Ponceblanc
Ranch Hand
Posts: 192
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you, my database is on hard disk!
as i am not of <string> of connection, i think that the user and the password must be in the persistence file .xml. But I do not know where to put it?

I start to know the driver jdbc has force to use it.

here is the persistence.xml

 
Philippe Ponceblanc
Ranch Hand
Posts: 192
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found the username without password !

here this is my file persistence.xml :



now i have a new error on my table and i don't anderstand !

 
Philippe Ponceblanc
Ranch Hand
Posts: 192
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my code of error hibernate >>  Could not determine type for: java.util.List, at table: Author, for columns: [org.hibernate.mapping.Column(authors)]


 
Philippe Ponceblanc
Ranch Hand
Posts: 192
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i forgot to annotate :


and now the debug of hibernate says me

Caused by: java.lang.IllegalStateException: The file is locked: nio:/home/phipo/.m2/repository/com/h2database/h2/1.4.196/db.mv.db [1.4.196/7]



WHY my database are loked ???
 
Philippe Ponceblanc
Ranch Hand
Posts: 192
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i restart my server and all it"s work !

Post/Thread SOLVED
 
It runs on an internal combustion engine. This ad does not:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!