Forums Register Login

Entities and JPA

+Pie Number of slices to send: Send
Hi,
Do I need to manually create the tables in my database (corresponding to my entities)? I thought they would be created automatically, but when trying to persist one of my entities I get this:

"Table 'mydatabase.myentity' doesn't exist"

Thanks, Jim
+Pie Number of slices to send: Send
I find its better to, although there is support to create the tables, assuming you have this feature turned on (probably in a server xml file). Either way this sounds like an issue for the object relational mapping forum...
+Pie Number of slices to send: Send
You can configure your hibernate.cfg.xml file to create the database when the configuration object is configured, or you can just run the following code snippet to have you database tables created for you:



It's the SchemaExport class that's doing all the heavy lifting here.



-Cameron McKenzie
+Pie Number of slices to send: Send
 

Originally posted by Cameron Wallace McKenzie:
You can configure your hibernate.cfg.xml file to create the database when the configuration object is configured, or you can just run the following code snippet to have you database tables created for you:



It's the SchemaExport class that's doing all the heavy lifting here.



-Cameron McKenzie



Hi McKenzie,

I have one small doubt here, Are you talking about "BOTTOM APPROACH" of creating database at the time of creating my Hibernate Session Factory?

Please clarify me, If I am wrong.

Ramesh
+Pie Number of slices to send: Send
Using a SchemaExport create would be considered a top down creation of database tables.

You do indeed need to have those database tables!

-Cameron McKenzie
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 954 times.
Similar Threads
hibernate and DB triggers
Entity Beans /DAO's
Showing JPA Entities in Diagrams
what are domain object and service entity?
javax.el.PropertyNotFoundException
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:14:27.