Naming Conventions When Performing O / R Matching

I map my database tables to my Java objects. Usually I call my plural tables that the table containing information about books is called BOOKS. The java object, however, is a single book and should be called Book. Similarly for AUTHORS / Author, etc.

On the other hand, simplifying it does the same for the domain object and table.

Is there some kind of naming convention that people follow? I assume this applies to applications in general, and not just when displaying O / R.

+3
source share
6 answers

Your initial thoughts are in place.

, .

, .

, Ruby on Rails, .

+8

OM.

person.last_name

people.last_name,

SQL Java (, , person.lastName, ).

+5

SubSonic ASP.NET, ActiveRecord. , .

Invoice, Invoices, 1 .

+1

, .

, - DbBooks, DbAuthors ..

0

CJ Date , . "". , .

user.email =? account.value (1,2,3)

to

users.email =? accounts.value (1,2,3)

( )

users.email =? account.values ​​ (1,2,3)

0

jOOQ Java . , , , , .

  • AUTHOR > AUTHOR
  • BOOKS > BOOKS

Classes that model objects (or records) will be marked as " Record":

  • AUTHOR > AuthorRecord
  • BOOKS > BooksRecord

This is pretty intuitive and versatile, no matter what you call your tables. Cm

http://www.jooq.org

0
source

Source: https://habr.com/ru/post/1709622/


All Articles