how I can do it if I want to store the id of the record in a value before i insert the record so I can use this id to insert different record in different table.
what I have now is insert statement to insert id (primary key of table),No,title,date ...... in table A, I want to save id before I insert or after so I can use it to insert id,A_id, points...…... in table B.
JSF doesn't have any database capabilities of its own. That's handled by other frameworks such as raw SQL JDBC or JPA.
A primary key is meaningless unless you have a table row for it to the the key for. You can either generate key values in program logic or in many databases/frameworks, you can have the key automatically generated for you. There's usually a choice of value generation algorithms available.
The only really tricky thing here is that once you've generated a primary key value for one record in a table, you have to make sure that that same key value doesn't get assigned to some other record in the table. That's usually done by some sort of synchronization or transaction management.
An IDE is no substitute for an Intelligent Developer.
posted 2 months ago
Thank you for your reply
Acutely, I have my tables and I use sequence in order to generate the key, and in the java application in my dao class I have method to insert statement (insert record) to the DB, and in my query I use NEXTVAL to insert the id, but want I it now is before I insert, I want the to save the value of the id or even after I insert I want to save the value of the id in order to use it as a value in the second table because this id is a foreign key in that table.