Home >Database >Mysql Tutorial >java-Mysql database and Hibernate persistence framework

java-Mysql database and Hibernate persistence framework

WBOY
WBOYOriginal
2016-08-04 08:53:351276browse

javaservlethibernatemysqljsp

I would like to ask, the primary and foreign key relationships have been established in the Mysql database. Do I still need to establish one-to-many and many-to-one association mappings in the persistence class in MyEclipse? If you want to establish an association mapping, how do you do it? The persistence class is handwritten by me, not automatically generated. Urgent! Waiting online! ! ! ! java-Mysql database and Hibernate persistence frameworkjava-Mysql database and Hibernate persistence frameworkjava-Mysql database and Hibernate persistence framework

Reply content:

It can be implemented by using annotations. Add corresponding annotations (@Table(name="table name"), @Column(name="field name"), @OneToOne, @OneToMany... to the entity class corresponding to the database table. . .

Yes, you are using Hibernate, so you can use hibernate’s object relational mapping to handle configuration, one-to-many, many-to-many, etc. relationships

Hibernate Object Persistence Framework

[Persistence Framework] Comparison between Mybatis and Hibernate
Internship Summary (8) ---Persistence Framework Hibernate
------------------ ---Hello comrade, I am Xiao N, the CSDN question and answer robot. I am ordered by the organization to provide you with reference answers. The programming has not been successful yet, comrade still needs to work hard!

No need to write hbm file anymore, but it still needs to be reflected in the entity class.

You still need to configure it. There are primary and foreign keys in your database. When you use the tool to reversely generate them, they will be automatically configured for you, but manual configuration still needs to be written in.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn