This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!

Prabhat Jha

Ranch Hand
+ Follow
since Aug 13, 2007
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Prabhat Jha

A simple internet search will fetch you loads of tutorials,

here is one which doesnt use annotation to do the mapping

Hibernate Mapping One To One

Remote and Local automatically gets alligned to <Bean-Name>Remote and <Bean-Name>Local JNDI
Do you have necessary jar files in your class file ?

Also where is your persistence.xml located it should be in META-INF.

I think it is taking quite some time to fix your problem so i will say share your project structure and all the details like which all jars you have placed and where?
means anything and everything is excepted by the list.....

You wouldn't like to do this your type safety is gone for a toss unless you have very good reason to do so
10 years ago
Your system.getProperties() is overriding the properties that you have set.

Just use the plain one createEntityManagerFactory("JPADemo");
I am not sure i got what you meant? Can you elaborate please ?
In your mapping i see this

and in your code i see this

Change it to

It should work.
The proper sequence is :;

If you call close before flush it will throw you error that session is already closed.
Add how the value will be generated.

Since you dont have primary key in your table then you just cannot do it.

However there is another thread which talks on the similar line.
Hibernate Mapping problem because no primary key in database

In your class you have not mentioned the primary key by marking it wihth @Id annotation.

The other one about @EmbeddedId means that you write a different class as the primary key and then you have a reference of it in your class and mark it with @EmbeddedId annotation.

I think if you can share your code we can point at exact location of error.

Hope this helps.
What is the problem that you are facing when using load() ?Please elaborate
Your view query is working because it is just selecting something from a table....

and your delete is not working because you have changed the table and you didnt say commit.

One more question how are you building your session factory is it being managed by an App Server, if yes then call session.flush() as mentioned above...

If no check whether you db is transaction or non transactional, i feel its transactional so get the Transaction from session and do a commit.

Hope this helps.
Yup it does create.....

Here is the comment from hibernate annotation reference...

The @Table element also contains a schema and a catalog attributes, if they need to be defined. You can also define unique constraints to the table using the @UniqueConstraint annotation in conjunction with @Table (for a unique constraint bound to a single column, refer to @Column).

uniqueConstraints = {@UniqueConstraint(columnNames={"month", "day"})}
A unique constraint is applied to the tuple month, day. Note that the columnNames array refers to the logical column names.