Use Hibernate for a long time, today I want to do a small example, the database uses Oracle. I intend to use the sequence in Oracle as the primary key of the table, but I don't know how to use Hibernate to associate with it. Ask a colleague, was told to use a query such as select statement "select sequence.nextval from dual",
method is as follows:
1, first create sequence2 in oracle. In your hbm. When the xml configuration is such that the data is reinserted, Hibernate automatically generates the following statement: automatically generates the next sequence value, and then inserts the object into the table. This problem is solved!
Sequence is to generate the primary key using the sequence mechanism provided by the database. For example, the Sequencenative in the oralce is generated by hibernate according to the Dialect of the database. One of the identity, hilo, and sequence is automatically used as the primary key generation method
create sequence seq_idminvalue 1start with 1increment by 1cache 20;
<id column="ID0000" name="id" type="integer"><generator class="sequence"><param name="sequence">seq_id</param> </generator></id>
hibernate: select seq_id.nextval from dual
hibernate: insert into YXJK.T_YXJK_WHRYTXL (XM0000, ZW0000,
LXDH00, SJHM00, DZYJ00, IP0000, ID0000) values (?, ?, ?, ?, ?, ?, ?)
There are some scenario where system admin wants only few users should be allowed to transfer files
How to uninstall the built-in JDK under Linux, many of us can find java under the operating system
In order to ensure the normal operation of the Linux system and accurately solve various system prob
The Gentoo Linux operating system (pronounced /ˈdʒɛntuː/) is a Linux meta-release
Linux handling of exceptions and interrupts
Socket programming under Linux
Low-key literary lizard: remember SUSE Linux 20th Anniversary
Possible problems with the nagios installation process
Nginx configuration refuses or allows IP
Linux view online users and kick out users
The difference between wire and reg in verilog HDL
In-depth study on Lvs scheduling strategy
How to let CentOS ban ping (anti-PING)
How to set the screen saver password to be safe
How to delete personal settings in the Win8 sync to the cloud
Using load balancing technology to build high-load network sites
Win7 flagship taskbar icon blank how is it?
Unlimited download of Ultimate Extras in Vista
You must know the top ten habits of using Windows 7
About gdb command knowledge in Linux system