This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Hibernate does not persist my database  RSS feed

 
Ranch Hand
Posts: 183
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: 183
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: 19996
95
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: 183
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: 183
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: 183
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: 183
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: 183
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i restart my server and all it"s work !

Post/Thread SOLVED
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!