hibernate Foreign key

hibernate Foreign key

sir, I am using hibernate in netbeans. I have 2 following tables

CREATE TABLE persons ( P_Id int(11) NOT NULL, LastName varchar(255) NOT NULL, FirstName varchar(255) DEFAULT NULL, Address varchar(255) DEFAULT NULL, City varchar(255) DEFAULT NULL, PRIMARY KEY (P_Id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1$$

CREATE TABLE orders ( O_Id int(11) NOT NULL, OrderNo int(11) NOT NULL, P_Id int(11) DEFAULT NULL, PRIMARY KEY (O_Id), KEY P_Id (P_Id), CONSTRAINT orders_ibfk_1 FOREIGN KEY (P_Id) REFERENCES persons (P_Id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1$$

I want to insert data using set methods in orders table in feild P_Id which is foreign key. How to insert? Thank you in advance.

View Answers

March 1, 2011 at 12:49 PM

Have a look at the given link:

Hibernate Tutorials

Ads









Related Tutorials/Questions & Answers:
hibernate Foreign key
hibernate Foreign key  sir, I am using hibernate in netbeans. I have...), KEY P_Id (P_Id), CONSTRAINT orders_ibfk_1 FOREIGN KEY (P_Id) REFERENCES... using set methods in orders table in feild P_Id which is foreign key. How to insert
Foreign key update table
Foreign key update table  How to update table that has the foreign key in SQL..?   ALTER TABLE YourTable ADD CONSTRAINT FK_YourForeignKey FOREIGN KEY (YourForeignKeyColumn) REFERENCES YourPrimaryTable
Advertisements
foreign key error in sql
foreign key error in sql  create table matchdetails(mid varchar2(10... varchar2(10),sixes varchar2(10),primary key(mid.pid), foreign key(mid... on foreign key can any one tell me plz how to reference matchdetails
Foreign key in mysql
Foreign key in mysql  Hi I am creating a website and linking..., there are foreign keys in some of the tables - does anyone know how to link the foreign key of one table into another table within phpmyadmin so the database
crud operations with foreign key constraint.
crud operations with foreign key constraint.  I neeed to know how to perform crud operations in mysql with foreign key constraint using mvc architecture i.e using servlet jsp and bean. please provide all the code so that i can
how to use foreign key in java
how to use foreign key in java  I have two tables in my MySQL... varchar(30), CONSTRAINT fkid FOREIGN KEY(idfk) REFERENCES table1(id) ON DELETE CASCADE ) The point is that table2 has a foreign key referencing the primary key
Mysql Alter Foreign Key
Mysql Alter Foreign Key       A Foreign Key is a field that marks to the primary key of another  table. The use of the foreign key is used to ensure referential
how tohow to create a table with primary key and foreign keyhow to create a table with primary key and foreign key
how tohow to create a table with primary key and foreign keyhow to create a table with primary key and foreign key  how to create a table using java language with primary key and foreign key   Hi Friend, A foreign
alter table add foreign key mysql
alter table add foreign key mysql  Hi, How to add foreign key in mysql using the query 'alter table add foreign key mysql' Thanks   Hi, We can use the following query: ALTER TABLE emp_address ADD FOREIGN KEY (emp_id
composinte primary key in hibernate
primary key with all the columns of the table and hibernate s/w has created two pojo...composinte primary key in hibernate  I am facing following problem, Inside the database(mssql), i have created a table without primary key
Hibernate unique key validation example
Hibernate unique key validation example  Hi, How to preform unique key validation in Hibernate application? Thanks   Hi, You write a program to check for the presence of the key in database before performing add
How to create primary key using hibernate?
How to create primary key using hibernate?  Hi, How to create primary key using hibernate? Thanks
hibernate annotations with composite primary key
hibernate annotations with composite primary key  I want to know how to use hibernate annotations in case of composite primary key in one table. I tried like this, I have created a table without primary key. By default mssql has
can we update table in hibernate with out primary key in table?
can we update table in hibernate with out primary key in table?  can we update table in hibernate with out primary key in table
Hibernate generator Element
In this tutorial you will learn about the hibernate's generator element , which is used to auto generate the primary key value
ModuleNotFoundError: No module named 'django-foreign-fields'
ModuleNotFoundError: No module named 'django-foreign-fields'  Hi...: No module named 'django-foreign-fields' How to remove the ModuleNotFoundError: No module named 'django-foreign-fields' error? Thanks   Hi
HIBERNATE
HIBERNATE   What is difference between Jdbc and Hibernate
hibernate
hibernate  what is hibernate flow
hibernate
hibernate  what is hibernate listeners
How to design key, design key, key
How to design key       It has been made easy now to design a key by this example, just...: Take "cccccc" color and choose Pen tool (P key), Make points. Select
hibernate
hibernate  please give me the link where i can freely download hibernate software(with dependencies)   Learn hibernate, if you want to learn hibernate, please visit the following link: Hibernate Tutorials
Hibernate
Hibernate  hibernate delete query execution
hibernate
hibernate  what is hibernate why we use
Hibernate
Hibernate  how to use pagination concept in Hibernate
hibernate
hibernate   I want to learn how to use hibernate framework in web application . for storing database in our application
hibernate
hibernate   I want to learn how to use hibernate framework in web application . for storing database in our application
hibernate
why hibernate?  why hibernate?   Hibernate: -Hibernate... library. It solves object-relational impedance mismatch problems. Hibernate makes the application development process easy Hibernate saves the development
ModuleNotFoundError: No module named 'odoo10-addon-bank-statement-foreign-currency'
ModuleNotFoundError: No module named 'odoo10-addon-bank-statement-foreign...: ModuleNotFoundError: No module named 'odoo10-addon-bank-statement-foreign-currency...-bank-statement-foreign-currency' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo11-addon-bank-statement-foreign-currency'
ModuleNotFoundError: No module named 'odoo11-addon-bank-statement-foreign...: ModuleNotFoundError: No module named 'odoo11-addon-bank-statement-foreign-currency...-bank-statement-foreign-currency' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo12-addon-bank-statement-foreign-currency'
ModuleNotFoundError: No module named 'odoo12-addon-bank-statement-foreign...: ModuleNotFoundError: No module named 'odoo12-addon-bank-statement-foreign-currency...-bank-statement-foreign-currency' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'odoo12-addon-bank-statement-foreign-currency'
ModuleNotFoundError: No module named 'odoo12-addon-bank-statement-foreign...: ModuleNotFoundError: No module named 'odoo12-addon-bank-statement-foreign-currency...-bank-statement-foreign-currency' error? Thanks   Hi, In your

Ads