Hibernate configuration files and Object relational mapping files learn about

Source: Internet
Author: User

Disclaimer : csdn do not know how, sometimes it is not published blog. Originally is a day a blog post, recently engaged I am very depressed. Sometimes one day, sometimes two or three days can not send. This is a force majeure. No way, when can send, I sent.

One, learning case: About hibernate configuration file and Object relational mapping file understanding.

Second, case analysis:

A) Hibernate configuration file (hibernate.cfg.xml)

1. Hibernate.dialect: SQL dialect used by database

2. Hiebrnate.connection.driver_class: Database driver

3. Hibernate.connection.url: The URL of the connection database

4, Hibernate.connection.username: The user name of the connection database

5, Hibernate.connection.password: Connect the database Password

6, Hibernate.show_sql:true indicates that when the program is run, the SQL statement is output in the console , the default false

7. Hbm2ddl.auto: Create indicates that the database table will be created automatically when Hibernate starts, update Indicates that The database table structure is updated when Hibernate starts (you can test the object to add fields, modify types, and so on).

B) Object Relational mapping file (Object.hbm.xml)

1, hibernate-mapping can be configured on the package name, if you do not configure The name in the class to fill in the name of the package with the name.

2, the ID tag must be configured Fuzhou generator. Hibernate provides a lot of information that you can view in the documentation. It is recommended to use native.

3, the property on the general configuration name , the name must be the same as the field in the POJO object. Type is optional and must be filled in individual special cases, such as date, character, text, etc.

4, the above is just the general understanding of the object-relational mapping file, for a pair of more, many to one, many-to-many, one-way, bidirectional and other related relations later, this is the difficulty of hibernate.

Third, Experience:

A) The difficulty of learning about hibernate is the relationship mapping, as I am now confused by the usual. Relational mapping has been done to a great extent to our coding and functional implementation. So we're not going to do more research.

b) Hibernate in the project as long as the relational mapping is basically OK , it is mainly more database-related, and the Web program has nothing to do . It's important to remember that even if you write application, you can use hibernate.

Iv. Reference items: None.

Five, a day of joy:

The foreman said to the new worker:" you are slow to do things, slow to walk, slow to move your brains, what do you do fast?" "
The new worker said," well , I'm tired fast." "

The final interpretation of the right to college students all. Reprint please indicate the source. @www. 23hhr.com

Hibernate configuration files and Object relational mapping files learn about

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.