Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Aphorismen
Applications
Business Economics & Admin.
My Computers
Cooking
Devices
Folders
Food
Hardware
Infos
Software Development
Sports
Operation Instructions
Todos
Test
Help
Glossary
Community portal
adaptions
Sidebar anpassen
Wiki RB4
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
JavaJEEJPA
(section)
Page
Discussion
English
Read
Edit
View history
Toolbox
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Entity Implementation=== with Spring Boot and Lombok: # <code>@Entity</code> annotation at class level # extend my BaseEntity class (documentation in java file) # decide if field or property access (by placing the annotations at the fields or at the getters). This a philosophical discussion in the community, but field access seems to be the easiest and appropriate way. # public or protected no-arg default ctor (e.g. Lombok @NoArgsConstructor) # <code>implements Serializable</code> If an entity instance is to be passed by value as a detached object (e.g., through a remote interface), the entity class must implement the Serializable interface # if not using Lombok annotation implement hashCode() and equals() if possible on a business or natural key and not on a generated id. Best solution is a generated UUID (search the web) # create DB table - iff you let the JPA provider create the DB tables for the entity there is a default mapping of Java types to DB columns. This could be a problem because for example the [[#Default_Mapping_for_Java_types|default mapping]] of String is VARCHAR(255), so strings are truncated to 255 chars. In most cases it is better to create the DB tables by a script. Topics to consider are: ##NOT NULL ##AUTOINCREMENT ##initial value # attribute names are mapped to db columns ## no capital letters ## capital letters in a string a prefixed with a underscore e.g. targetDate => target_date, isDone => is_done
Summary:
Please note that all contributions to Wiki RB4 may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Uwe Heuer Wiki New:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width