ORM is offensive

/11@yegor256 1
ORM - это обидно
Егор Бугаенко
ORM is an offensive anti-pattern
/11@yegor256 2
@Entity
@Table(name = "post")
public class Post {
private int id;
private String title;
@Id
@GeneratedValue
public int getId() {
return this.id;
}
@Column(name = "title")
public Title getTitle() {
return this.title;
}
public void setTitle(String txt) {
this.title = txt;
}
}
/11@yegor256
3
MySQL
JDBC
UPDATE user

SET name = “Jeff”

WHERE id = 123
u.getName();
statement.executeUpdate();
setName() this.name = “Jeff”;
u.setName(“Jeff”);
session.update(u);
update()
User
Session
/11@yegor256 4
не объект
/11@yegor256 5
Session session = factory.openSession();
try {
Transaction txn = session.beginTransaction();
User user = query.list().get(0);
user.setName(/* the logic to test */);
session.update(user);
txn.commit();
} catch (HibernateException ex) {
txn.rollback();
} finally {
session.close();
}
/11@yegor256 6
public class LoggedUser implements User {
private final User origin;
public LoggedUser(User user) {
this.origin = user;
}
@Override
public void rename(String name) {
long start = System.currentTimeMillis();
this.origin.rename(name);
logger.debug(
“user renaming took %d ms”,
System.currentTimeMillis() - start
);
}
}
/11@yegor256 7
List posts = session.createQuery(
"FROM Post WHERE author = ‘Jeff’”
).list();
for (Post post : (List<Post>) posts){
System.out.println(
"Title: " + post.getTitle()
);
}
/11@yegor256 8
SQL-speaking объекты
/11@yegor256 9
MySQL
JDBC
UPDATE user

SET name = “Jeff”

WHERE id = 123
statement.executeUpdate();
rename()
x.update(“user”)
.set(“name”, “Jeff”)
.where(“id”, 123)
.execute();
u.rename(“Jeff”); User
jOOQ
/11@yegor256 10
public class Post {
private int id;
public int getId() {
return this.id;
}
public Title getTitle() {
return this.x.select(“title”)
.from(“post”)
.where(“id”, this.id)
.fetchOne();
}
public void setTitle(String txt) {
this.x.update(“user”)
.set(“title”, txt)
.where(“id”, this.id)
.execute();
}
}
/11@yegor256 11
www.yegor256.com
1 of 11

Recommended

How Much Immutability Is Enough? by
How Much Immutability Is Enough?How Much Immutability Is Enough?
How Much Immutability Is Enough?Yegor Bugayenko
1.7K views22 slides
MooseX::Datamodel - Barcelona Perl Workshop Lightning talk by
MooseX::Datamodel - Barcelona Perl Workshop Lightning talkMooseX::Datamodel - Barcelona Perl Workshop Lightning talk
MooseX::Datamodel - Barcelona Perl Workshop Lightning talkJose Luis Martínez
736 views16 slides
PHP - PDO Objects by
PHP - PDO ObjectsPHP - PDO Objects
PHP - PDO ObjectsAJINKYA N
2K views13 slides
Database adapter by
Database adapterDatabase adapter
Database adapterprathap kumar
168 views9 slides
How to write bad code in redux (ReactNext 2018) by
How to write bad code in redux (ReactNext 2018)How to write bad code in redux (ReactNext 2018)
How to write bad code in redux (ReactNext 2018)500Tech
404 views65 slides
Connectivity coding for java and mysql by
Connectivity coding for java and mysqlConnectivity coding for java and mysql
Connectivity coding for java and mysqlFahad Ali Khan
95 views9 slides

More Related Content

What's hot

Email Program By Marcelo by
Email Program By MarceloEmail Program By Marcelo
Email Program By MarceloDomingos Salvador
387 views21 slides
Lecture6 display data by okello erick by
Lecture6 display data by okello erickLecture6 display data by okello erick
Lecture6 display data by okello erickokelloerick
35 views20 slides
Ejb3 Struts Tutorial En by
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial EnAnkur Dongre
703 views47 slides
Binary tree in java by
Binary tree in javaBinary tree in java
Binary tree in javaProgramming Homework Help
197 views4 slides
TDD in the wild by
TDD in the wildTDD in the wild
TDD in the wildBrainhub
128 views50 slides
Client Server Communication on iOS by
Client Server Communication on iOSClient Server Communication on iOS
Client Server Communication on iOSMake School
1.2K views22 slides

What's hot(16)

Lecture6 display data by okello erick by okelloerick
Lecture6 display data by okello erickLecture6 display data by okello erick
Lecture6 display data by okello erick
okelloerick35 views
Ejb3 Struts Tutorial En by Ankur Dongre
Ejb3 Struts Tutorial EnEjb3 Struts Tutorial En
Ejb3 Struts Tutorial En
Ankur Dongre703 views
TDD in the wild by Brainhub
TDD in the wildTDD in the wild
TDD in the wild
Brainhub128 views
Client Server Communication on iOS by Make School
Client Server Communication on iOSClient Server Communication on iOS
Client Server Communication on iOS
Make School1.2K views
Ext GWT 3.0 Advanced Templates by Sencha
Ext GWT 3.0 Advanced TemplatesExt GWT 3.0 Advanced Templates
Ext GWT 3.0 Advanced Templates
Sencha1.9K views
Retrieving data from database using result set (1) by rishisingh190
Retrieving data from database using result set (1)Retrieving data from database using result set (1)
Retrieving data from database using result set (1)
rishisingh19085 views
Getting started with Elasticsearch and .NET by Tomas Jansson
Getting started with Elasticsearch and .NETGetting started with Elasticsearch and .NET
Getting started with Elasticsearch and .NET
Tomas Jansson35.7K views
Windows 8 Training Fundamental - 1 by Kevin Octavian
Windows 8 Training Fundamental - 1Windows 8 Training Fundamental - 1
Windows 8 Training Fundamental - 1
Kevin Octavian3.1K views
Solr integration in Magento Enterprise by Tobias Zander
Solr integration in Magento EnterpriseSolr integration in Magento Enterprise
Solr integration in Magento Enterprise
Tobias Zander2K views
Android Cursor Utils - NYC Android Meetup by Ron Shapiro
Android Cursor Utils - NYC Android MeetupAndroid Cursor Utils - NYC Android Meetup
Android Cursor Utils - NYC Android Meetup
Ron Shapiro1.2K views

Viewers also liked

Object Oriented Lies by
Object Oriented LiesObject Oriented Lies
Object Oriented LiesYegor Bugayenko
2.4K views13 slides
Practical Example of AOP with AspectJ by
Practical Example of AOP with AspectJPractical Example of AOP with AspectJ
Practical Example of AOP with AspectJYegor Bugayenko
1.4K views23 slides
ORM is a perfect anti-pattern by
ORM is a perfect anti-patternORM is a perfect anti-pattern
ORM is a perfect anti-patternYegor Bugayenko
2.3K views10 slides
ORM is an Offensive Anti-Pattern by
ORM is an Offensive Anti-PatternORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-PatternYegor Bugayenko
1.4K views24 slides
How Anemic Objects Kill OOP by
How Anemic Objects Kill OOPHow Anemic Objects Kill OOP
How Anemic Objects Kill OOPYegor Bugayenko
2K views16 slides
Built-in Fake Objects by
Built-in Fake ObjectsBuilt-in Fake Objects
Built-in Fake ObjectsYegor Bugayenko
1.1K views30 slides

Viewers also liked(20)

Practical Example of AOP with AspectJ by Yegor Bugayenko
Practical Example of AOP with AspectJPractical Example of AOP with AspectJ
Practical Example of AOP with AspectJ
Yegor Bugayenko1.4K views
ORM is a perfect anti-pattern by Yegor Bugayenko
ORM is a perfect anti-patternORM is a perfect anti-pattern
ORM is a perfect anti-pattern
Yegor Bugayenko2.3K views
ORM is an Offensive Anti-Pattern by Yegor Bugayenko
ORM is an Offensive Anti-PatternORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-Pattern
Yegor Bugayenko1.4K views
The Plain English Guide To Customer Research by ORM
The Plain English Guide To Customer ResearchThe Plain English Guide To Customer Research
The Plain English Guide To Customer Research
ORM1.1K views
A Quick Preview of What You'll See at Qt World Summit 2016 by Qt
A Quick Preview of What You'll See at Qt World Summit 2016A Quick Preview of What You'll See at Qt World Summit 2016
A Quick Preview of What You'll See at Qt World Summit 2016
Qt5.9K views
Need It Robust? Make It Fragile! by Yegor Bugayenko
Need It Robust? Make It Fragile!Need It Robust? Make It Fragile!
Need It Robust? Make It Fragile!
Yegor Bugayenko1.7K views
How Do You Know When Your Product is Ready to be Shipped? by Yegor Bugayenko
How Do You Know When Your Product is Ready to be Shipped?How Do You Know When Your Product is Ready to be Shipped?
How Do You Know When Your Product is Ready to be Shipped?
Yegor Bugayenko1.1K views

Similar to ORM is offensive

Advance Java Programs skeleton by
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
4K views18 slides
Android Architecture - Khoa Tran by
Android Architecture -  Khoa TranAndroid Architecture -  Khoa Tran
Android Architecture - Khoa TranTu Le Dinh
534 views40 slides
Xml & Java by
Xml & JavaXml & Java
Xml & JavaSlim Ouertani
1.5K views19 slides
Form認証で学ぶSpring Security入門 by
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Ryosuke Uchitate
11.2K views64 slides
import java.sql.;public class Lab5Starter { public static v.pdf by
import java.sql.;public class Lab5Starter {   public static v.pdfimport java.sql.;public class Lab5Starter {   public static v.pdf
import java.sql.;public class Lab5Starter { public static v.pdfstopgolook
3 views2 slides
Soundreader.classpathSoundreader.project Soundre.docx by
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docxwhitneyleman54422
2 views16 slides

Similar to ORM is offensive(17)

Android Architecture - Khoa Tran by Tu Le Dinh
Android Architecture -  Khoa TranAndroid Architecture -  Khoa Tran
Android Architecture - Khoa Tran
Tu Le Dinh534 views
Form認証で学ぶSpring Security入門 by Ryosuke Uchitate
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門
Ryosuke Uchitate11.2K views
import java.sql.;public class Lab5Starter { public static v.pdf by stopgolook
import java.sql.;public class Lab5Starter {   public static v.pdfimport java.sql.;public class Lab5Starter {   public static v.pdf
import java.sql.;public class Lab5Starter { public static v.pdf
stopgolook3 views
Soundreader.classpathSoundreader.project Soundre.docx by whitneyleman54422
Soundreader.classpathSoundreader.project  Soundre.docxSoundreader.classpathSoundreader.project  Soundre.docx
Soundreader.classpathSoundreader.project Soundre.docx
publicclass Athlete {Attributesprivate String firstName;priv.pdf by aquacareser
publicclass Athlete {Attributesprivate String firstName;priv.pdfpublicclass Athlete {Attributesprivate String firstName;priv.pdf
publicclass Athlete {Attributesprivate String firstName;priv.pdf
aquacareser2 views
Androidの本当にあった怖い話 by Yusuke Yamamoto
Androidの本当にあった怖い話Androidの本当にあった怖い話
Androidの本当にあった怖い話
Yusuke Yamamoto6.9K views
Oracle XML Handling by azharpro
Oracle XML HandlingOracle XML Handling
Oracle XML Handling
azharpro808 views
ESNext for humans - LvivJS 16 August 2014 by Jan Jongboom
ESNext for humans - LvivJS 16 August 2014ESNext for humans - LvivJS 16 August 2014
ESNext for humans - LvivJS 16 August 2014
Jan Jongboom3.6K views
Lombokの紹介 by onozaty
Lombokの紹介Lombokの紹介
Lombokの紹介
onozaty2.5K views
บทที่6 update&delete by Palm Unnop
บทที่6 update&deleteบทที่6 update&delete
บทที่6 update&delete
Palm Unnop416 views
Answer is 77777Driverprogram.java AUTHOR CHEG.pdf by anjaniar7gallery
Answer is 77777Driverprogram.java   AUTHOR CHEG.pdfAnswer is 77777Driverprogram.java   AUTHOR CHEG.pdf
Answer is 77777Driverprogram.java AUTHOR CHEG.pdf
Teste de Integração com DbUnit e jIntegrity by Washington Botelho
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
Washington Botelho1.6K views
Java → kotlin: Tests Made Simple by leonsabr
Java → kotlin: Tests Made SimpleJava → kotlin: Tests Made Simple
Java → kotlin: Tests Made Simple
leonsabr4.4K views

More from Yegor Bugayenko

Can Distributed Teams Deliver Quality? by
Can Distributed Teams Deliver Quality?Can Distributed Teams Deliver Quality?
Can Distributed Teams Deliver Quality?Yegor Bugayenko
269 views23 slides
Are You Sure You Are Not a Micromanager? by
Are You Sure You Are Not a Micromanager?Are You Sure You Are Not a Micromanager?
Are You Sure You Are Not a Micromanager?Yegor Bugayenko
245 views16 slides
On Requirements Management (Demotivate Them Right) by
On Requirements Management (Demotivate Them Right)On Requirements Management (Demotivate Them Right)
On Requirements Management (Demotivate Them Right)Yegor Bugayenko
220 views16 slides
My Experience of 1000 Interviews by
My Experience of 1000 InterviewsMy Experience of 1000 Interviews
My Experience of 1000 InterviewsYegor Bugayenko
218 views20 slides
Are you sure you are not a micromanager? by
Are you sure you are not a micromanager?Are you sure you are not a micromanager?
Are you sure you are not a micromanager?Yegor Bugayenko
251 views15 slides
Quality Assurance vs. Testing by
Quality Assurance vs. TestingQuality Assurance vs. Testing
Quality Assurance vs. TestingYegor Bugayenko
660 views25 slides

More from Yegor Bugayenko(20)

Can Distributed Teams Deliver Quality? by Yegor Bugayenko
Can Distributed Teams Deliver Quality?Can Distributed Teams Deliver Quality?
Can Distributed Teams Deliver Quality?
Yegor Bugayenko269 views
Are You Sure You Are Not a Micromanager? by Yegor Bugayenko
Are You Sure You Are Not a Micromanager?Are You Sure You Are Not a Micromanager?
Are You Sure You Are Not a Micromanager?
Yegor Bugayenko245 views
On Requirements Management (Demotivate Them Right) by Yegor Bugayenko
On Requirements Management (Demotivate Them Right)On Requirements Management (Demotivate Them Right)
On Requirements Management (Demotivate Them Right)
Yegor Bugayenko220 views
My Experience of 1000 Interviews by Yegor Bugayenko
My Experience of 1000 InterviewsMy Experience of 1000 Interviews
My Experience of 1000 Interviews
Yegor Bugayenko218 views
Are you sure you are not a micromanager? by Yegor Bugayenko
Are you sure you are not a micromanager?Are you sure you are not a micromanager?
Are you sure you are not a micromanager?
Yegor Bugayenko251 views
Zold: a cryptocurrency without Blockchain by Yegor Bugayenko
Zold: a cryptocurrency without BlockchainZold: a cryptocurrency without Blockchain
Zold: a cryptocurrency without Blockchain
Yegor Bugayenko282 views
How to Cut Corners and Stay Cool by Yegor Bugayenko
How to Cut Corners and Stay CoolHow to Cut Corners and Stay Cool
How to Cut Corners and Stay Cool
Yegor Bugayenko318 views

Recently uploaded

DevsRank by
DevsRankDevsRank
DevsRankdevsrank786
11 views1 slide
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... by
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...Deltares
9 views26 slides
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... by
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Donato Onofri
711 views34 slides
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM... by
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...Deltares
7 views40 slides
LAVADORA ROLO.docx by
LAVADORA ROLO.docxLAVADORA ROLO.docx
LAVADORA ROLO.docxSamuelRamirez83524
7 views1 slide
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... by
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...Deltares
16 views12 slides

Recently uploaded(20)

DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t... by Deltares
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
DSD-INT 2023 Thermobaricity in 3D DCSM-FM - taking pressure into account in t...
Deltares9 views
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... by Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri711 views
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM... by Deltares
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
DSD-INT 2023 Next-Generation Flood Inundation Mapping for Taiwan - Delft3D FM...
Deltares7 views
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
Deltares16 views
Cycleops - Automate deployments on top of bare metal.pptx by Thanassis Parathyras
Cycleops - Automate deployments on top of bare metal.pptxCycleops - Automate deployments on top of bare metal.pptx
Cycleops - Automate deployments on top of bare metal.pptx
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon by Deltares
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
Deltares13 views
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... by Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares11 views
Software testing company in India.pptx by SakshiPatel82
Software testing company in India.pptxSoftware testing company in India.pptx
Software testing company in India.pptx
SakshiPatel827 views
360 graden fabriek by info33492
360 graden fabriek360 graden fabriek
360 graden fabriek
info3349224 views
Generic or specific? Making sensible software design decisions by Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut... by HCLSoftware
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
HCLSoftware6 views
Software evolution understanding: Automatic extraction of software identifier... by Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
SUGCON ANZ Presentation V2.1 Final.pptx by Jack Spektor
SUGCON ANZ Presentation V2.1 Final.pptxSUGCON ANZ Presentation V2.1 Final.pptx
SUGCON ANZ Presentation V2.1 Final.pptx
Jack Spektor22 views
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... by Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 views
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views

ORM is offensive

  • 1. /11@yegor256 1 ORM - это обидно Егор Бугаенко ORM is an offensive anti-pattern
  • 2. /11@yegor256 2 @Entity @Table(name = "post") public class Post { private int id; private String title; @Id @GeneratedValue public int getId() { return this.id; } @Column(name = "title") public Title getTitle() { return this.title; } public void setTitle(String txt) { this.title = txt; } }
  • 3. /11@yegor256 3 MySQL JDBC UPDATE user
 SET name = “Jeff”
 WHERE id = 123 u.getName(); statement.executeUpdate(); setName() this.name = “Jeff”; u.setName(“Jeff”); session.update(u); update() User Session
  • 5. /11@yegor256 5 Session session = factory.openSession(); try { Transaction txn = session.beginTransaction(); User user = query.list().get(0); user.setName(/* the logic to test */); session.update(user); txn.commit(); } catch (HibernateException ex) { txn.rollback(); } finally { session.close(); }
  • 6. /11@yegor256 6 public class LoggedUser implements User { private final User origin; public LoggedUser(User user) { this.origin = user; } @Override public void rename(String name) { long start = System.currentTimeMillis(); this.origin.rename(name); logger.debug( “user renaming took %d ms”, System.currentTimeMillis() - start ); } }
  • 7. /11@yegor256 7 List posts = session.createQuery( "FROM Post WHERE author = ‘Jeff’” ).list(); for (Post post : (List<Post>) posts){ System.out.println( "Title: " + post.getTitle() ); }
  • 9. /11@yegor256 9 MySQL JDBC UPDATE user
 SET name = “Jeff”
 WHERE id = 123 statement.executeUpdate(); rename() x.update(“user”) .set(“name”, “Jeff”) .where(“id”, 123) .execute(); u.rename(“Jeff”); User jOOQ
  • 10. /11@yegor256 10 public class Post { private int id; public int getId() { return this.id; } public Title getTitle() { return this.x.select(“title”) .from(“post”) .where(“id”, this.id) .fetchOne(); } public void setTitle(String txt) { this.x.update(“user”) .set(“title”, txt) .where(“id”, this.id) .execute(); } }