hibernate: foreign key is primary key -


I have 2 tables related to each other:

  ** message ** (id, name, content) ** schedule_reference ** (message_id, start_time, stop_time)  

I use message_id for the primary scheduled_message table.

My domain class:

  public class messages {private integer ID; The name of the private string; Private string content; ...} public class scheduled messages {private message messages; Private date start time; Private date stoptime; }  

I try to type Hibernate XML config for mapping 2 sections, but still error in message_id: (

  & lt; Class name = "Message" table = "message">  gt; & lt; / id & Property name = "name" column = "name" / "property name =" content "column =" content "/> gt; & lt; / class & gt; class name =" scheduled message " Table = "Scheduled Meas" & gt; & lt; id name = "message" column = "message_id" & gt; provider name = "start time" call M = "start_time" / "gt; property name =" stoptime "column =" stop_time "/> gt; & lt; one-to-one name =" message "constrain =" right "/> gt; / Class>  

error: could not determine type for: cbs.domain.Message, on table: schedule_reference, for column: [org.hibernate.mapping.Column (message_id) ]

Help me plz

thanks

Q

Whatever you have here can be seen in a different way. Rather than exposing scheduled message to message property, you can see that scheduled message is a special type of message - In other words, having a subclass in Hibernation allows you to mapped such inherited relationships in many ways - which is called "table per subclass" here if you read, all this Make it clear and raise you and walk Give enough example code for the field.

Alternatively, to adhere to your current point of view, you get a scheduled message but with only one component.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -