- This topic has 9 replies, 3 voices, and was last updated 14 years, 7 months ago by
support-swapna.
-
AuthorPosts
-
JamesRaynorMemberhi
i am doing a three table database: state, county, and city.
state table only has a st_key and name,
county table has cnt_key, name and st_key as FK.
and the city table has a key, ct_key, cnt_key, st_key and nameright now i am only doing some testing on how to use hibernate and i am creating my classes for that. the problem is when i try to insert.
hibernate created for me the abstractState, state and stateDAO,
so i do what the tutorials say i must do:
create my state
set it
put it in a dao
and commit itbut when i check my table in oracle i see that the key that i set is not what set it to
the update and delete seem to work for the values already there.and something curious, when i tries to see all of my methods for the state there was no setId. is there a problem with that?
November 10, 2010 at 12:35 am #312586
support-shaliniMemberJamesRaynor,
I am unable to replicate it at my end.
Do you see any errors specific to hibernate in the log file? You can find it at <workspacedir>/.metadata folder.
Here are the links which can help you with creating Hibernate projects.
http://www.myeclipseide.com/documentation/quickstarts/hibernate/
http://www.myeclipseide.com/documentation/quickstarts/hibernateintroduction/Please go through them and try creating a new Project.
Do let us know how it works for you.
November 10, 2010 at 10:25 am #312598
JamesRaynorMemberthank you shalini,
but i was using those tutorials, i have redone everything(thats java) and get the same result.
one thing that i get is that when i retry to save a dao that already exists instead of not doing anything and keeping the database as is, it generates a new entry.
for example if i enter in the state table:
st_key = 1, name = abc
and then do it again
i get a table like:st_key | name
1 | abc
11 | abc
12 | abc
13 | abc
and so onand i get that even if i change the key…
is there something like an auto generate key on hibernate? or maybe its oracle?
but i didn’t set my tables like that, but if so where can i check if i did?i am a complete noob on oracle, but i find it very useful. any web page or tutorial that you recommend????
November 10, 2010 at 10:26 am #312599
JamesRaynorMemberthank you shalini,
but i was using those tutorials, i have redone everything(thats java) and get the same result.
one thing that i get is that when i retry to save a dao that already exists instead of not doing anything and keeping the database as is, it generates a new entry.
for example if i enter in the state table:
st_key = 1, name = abc
and then do it again
i get a table like:st_key | name
1 | abc
11 | abc
12 | abc
13 | abc
and so onand i get that even if i change the key…
is there something like an auto generate key on hibernate? or maybe its oracle?
but i didn’t set my tables like that, but if so where can i check if i did?i am a complete noob on oracle, but i find it very useful. any web page or tutorial that you recommend????
November 10, 2010 at 10:27 am #312600
JamesRaynorMemberthank you shalini,
but i was using those tutorials, i have redone everything(thats java) and get the same result.
one thing that i get is that when i retry to save a dao that already exists instead of not doing anything and keeping the database as is, it generates a new entry.
for example if i enter in the state table:
st_key = 1, name = abc
and then do it again
i get a table like:st_key | name
1 | abc
11 | abc
12 | abc
13 | abc
and so onand i get that even if i change the key…
is there something like an auto generate key on hibernate? or maybe its oracle?
but i didn’t set my tables like that, but if so where can i check if i did?i am a complete noob on oracle, but i find it very useful. any web page or tutorial that you recommend????
November 10, 2010 at 10:27 am #312601
JamesRaynorMemberthank you shalini,
but i was using those tutorials, i have redone everything(thats java) and get the same result.
one thing that i get is that when i retry to save a dao that already exists instead of not doing anything and keeping the database as is, it generates a new entry.
for example if i enter in the state table:
st_key = 1, name = abc
and then do it again
i get a table like:st_key | name
1 | abc
11 | abc
12 | abc
13 | abc
and so onand i get that even if i change the key…
is there something like an auto generate key on hibernate? or maybe its oracle?
but i didn’t set my tables like that, but if so where can i check if i did?i am a complete noob on oracle, but i find it very useful. any web page or tutorial that you recommend????
November 10, 2010 at 10:52 am #312607
JamesRaynorMemberooops
sorry about that i got a php error and thought that it didnt postNovember 15, 2010 at 12:44 am #312663
support-swapnaModeratorThis message has not been recovered.
Attachments:
You must be logged in to view attached files.November 16, 2010 at 10:54 am #312706
JamesRaynorMemberThis message has not been recovered.
November 16, 2010 at 9:41 pm #312715
support-swapnaModeratorThis message has not been recovered.
-
AuthorPosts