This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring forum!

Sai Kiran nukala

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

Recent posts by Sai Kiran nukala

Hi frnds...i got a prob. i am posting everything what i wrote....In database there are two tables Person and Car

Person table(id,name,address)
Car table(id,brand,person_id)....person_id is FK from person table.


Person Class:



Car Class:


Car Mapping file:



Person Mapping file:


Connection class where i created session and all others.




here i created one-to-one mapping using <many-to-one> relation by putting "unique" attribute to true in Person mapping file. And when i execute it i got an error which is shown below:


Frnds please help me in clearing this mapping relation i'm very confused with this. Waiting for your valuable replies. If i did any mistake in the above code. Please correct me...

Thank in advance.
Thanks mark.....I will do that....
Thanks Mark it is working now...thanks a lot......and if you don't mind can you suggest me a book or tutorial where i can learn completely about the relationships in hibernate??
Thanks Mark it is working now...thanks a lot......
Hi friends i got a problem in specifying many to one relationship....i have two tables

1. Usertable
2. Country Table

Usertable has user_id,user_name,user_password,country_id (country_id is a FK,which is PK in Country table)

Country has country_id, country_name

I wrote two classes one for usertable and other for country table.

User class:




Country Class:


Mapping files:

Country mapping file:


User Mapping file:



This is how I'm setting the data and inserting: (I mentioned only the necessary code)





Now the actual problem is country table has the data already. so when a new user registers I need to place the values into the Usertable without inserting new values into the country table. But when i insert the data into the Usertable this is the error i'm getting




The important thing is when I insert the data it is asking for the country_id which i already set the value in the Country object of User Class this we can
see that java code which i used above to insert the values into the Database. It is not using the country id which I already set in the Country object....Why?? Did i made any mistake in mentioning <many-to-one> relation???can you all help me??it is urgent I'm stuck here....

Thanks in advance...waiting for your valuable replies friends...and don't mind for the very long code I posted....I mentioned everything what I wrote.


thanks for the reply friends when i see the w3schools site it gave an example with .NET........but my question is how to use web services with java???
13 years ago
Hello everyone,
I'm new to webservices...so i want to know what is a webservice? and how to write a java write a java webserivce(i'll be thankful if someone explain with an example).

Thanks in advance...
13 years ago
@suresh

Hi suresh can you specify the error....???
13 years ago