Nhib.pdf and Cuyahoga (2)

Source: Internet
Author: User
Original article: http://www.cuyahoga-project.org/home/developers.aspx

Mappings: 

When we use powerful ORM tools like nhib.pdf, The ing classes are sometimes quite strict. this has caused a lot of obstacles, especially because there are not enough real ing examples (more specifically, there will be more examples for hibernate of the Java version ).
Tip: to better understand this pieceArticle, It is best to have a Cuyahoga source code. In this article, there is a reference to the source code connection.

Mapping Files:
 

Like other nhib.pdf examples, ing files are organized together. For each domain class, there is a. HBM. xml file containing ing information. These files are compiled into the resource file.ProgramCentralized. You can see that they and the domain class are put in the Cuyahoga/CORE/domain folder together.
In modules, the ing file is put in the same folder as other modules files (articlesmodules is the best demonstration .).

Common aspects in Mapping Files: 

Most ing files usually have two parts:

1: keys in the database are usually automatically generated. The results in the ing file are as follows:

< ID name = " ID " Column = " Nodeid " Type = " Int32 " Unsaved - Value = " -1 " >
< Generator Class = " Native " >
< Param name = " Sequence " > Cuyahoga_node_nodeid_seq </ Param >
</ Generator >
</ ID >  

This sequence element is required for the PostgreSQL database, and can be ignored by other (sqlserver, MySQL.

2: timestamps is used for optimistic concurrency.

< Timestamp name = " Updatetimestamp " Column = " Updatetimestamp "   />  

It is wise to use version numbers for version elements, but since Cuyahoga has used updatetimestamp in the database before using nhib.pdf
Objective concurrency is quite easy.

So, how can I learn a bit more about mappings?
 

Well ....., Ing is so many that it cannot explain all the details. The best way is to browse with the help of class digoal and database digoal.Code.
The Cuyahoga. Core. domain. node class may be the best start. It has several relationships with other classes, including bidirectional (yes, inverse-related) and ing Union classes.

For the sake of overall understanding, you may already want to check the admin page code to see how these ing objects run. these management pages are better than those for end users (such as Cuyahoga. web. UI. pageengine class) to be more direct and easier to understand.

Reference:
 

The following table briefly describes the cuing in Cuyahoga and points out where these classes can be found.

relation type

collection type

Mapping File

classes

remarks

one-second

bag

node. HBM. XML

node <-> section

bi-directional

node <-> node (parent- child)

bi-directional

moduletype. HBM. XML

moduletype-> modulesetting

composite element

Map

section. HBM. XML

section-> Settings

name-value pairs

Accept-ignore

bag

User. HBM. XML

User-> role

node. HBM. XML

node-> role

nodepermission as association class, composite Element

List

menu. HBM. XML

menu-> node

allow-one

N/A

node. HBM. XML

node <-site

bi-directional

node <-template

node <-node (parent-child)

bi-directional

section. HBM. XML

section <-moduletype

section <-node

bi-directional

Article. HBM. XML (in articlemodule)

Article <-Category

Article <-section

multi-Assembly

Article <-user

multi-Assembly

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.