Forums Register Login

how to map POJOs to table in Hibernate without setting the mapping class or mapping resources in Hib

+Pie Number of slices to send: Send
Hi,

Can any one tell me how to map POJOs to table in Hibernate without setting the mapping class or mapping resources properties in Hibernate.cfg.xml

While learning hibernate, i was asked to map the POJO classes in the hibernate.cfg.xml. When i run the small application without mapping the POJO classes in the hibernate.cfg.xml file, it throws error saying that

Unknown entity: <entire package>.<POJO clas>

But in big applications, i have seen a Hibernate.cfg.xml file where no POJO classes mapping are there. How does big application working fine without mapping the POJO classses in the configuration file.

Regards
Ramki S
+Pie Number of slices to send: Send
You can also use a persistence.xml or annotations on the POJO.
+Pie Number of slices to send: Send
Hi E Armitage,

Can you please explain me this with an example.

Regards
Ramki S
+Pie Number of slices to send: Send
How that is done using the persistence.xml. Please any one explain it with an example

Regards
Ramki S
Roses are red, violets are blue. Some poems rhyme and some don't. And some poems are a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1065 times.
Similar Threads
Hibernate + Configuration.addClass Exception
Configuring Hibernate with two databases
java.lang.ClassNotFoundException: javax.persistence.JoinTable
hibernate hello world
hibernate package problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 23:44:39.