training: day three - persistence
DESCRIPTION
This is the third in our four part training sessions introducing FenixEdu development for new collaborators. In this third session, we introduce our persistence technology and database engine as well how to commit database changes to version control.TRANSCRIPT
![Page 1: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/1.jpg)
PersistenceSQL, Domain & Fenix Framework
![Page 2: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/2.jpg)
How to change your gradesSQL, Domain & Fenix Framework
![Page 3: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/3.jpg)
MySQL
Application Container (Tomcat, Jetty)
Fenix Framework(STM)
DomainModel
JSPrenderers
Struts
Faces
Jersey(REST API)
![Page 4: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/4.jpg)
Fenix Framework
● Software Transactional Machine
● Developed in part by our Team
● Available at:○ https://github.com/fenix-framework/fenix-framework
![Page 5: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/5.jpg)
Fenix Framework
class PendingRequest {
DateTime generationDate;
String url;
Boolean post;
String buildVersion;
}
relation PendingRequestRootDomainObject {
RootDomainObject playsRole rootDomainObject;
PendingRequest playsRole pendingRequest {
multiplicity *;
}
}
DML
![Page 6: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/6.jpg)
Fenix FrameworkDML
valueType java.math.BigDecimal as BigDecimal {
externalizeWith {
String toString();
}
}
enum net.sourceforge.fenixedu.util.WeekDay as WeekDay;
![Page 7: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/7.jpg)
Fenix Framework
Entity DomainObjectRootDomainObject
1 *
DML
![Page 8: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/8.jpg)
Fenix Framework
class Degree extends AcademicProgram {
Double ectsCredits;
String nome (REQUIRED);
}
DML
![Page 9: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/9.jpg)
Fenix Framework
@ConsistencyPredicate
private boolean checkRequiredSlots() {
ConsistencyChecks.checkRequired(this, "nome", getNome());
return true;
}
DML
![Page 10: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/10.jpg)
Fenix FrameworkTransactions
● Use @Atomic
● Can be READ, WRITE, SPECULATIVE_READ
● DO NOT USE IN ACTIONS!
![Page 11: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/11.jpg)
Fenix Framework
● /src/main/dml/domain_model.dml
● 1370 Entities, 1802 Relations, 54 Value Types & 200 Enums
DML
![Page 12: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/12.jpg)
![Page 13: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/13.jpg)
Fenix FrameworkFenix Domain Browser
● Available at:○ https://fenix-ashes.ist.utl.pt/fdb/
● Source code at:○ https://github.com/nurv/Fenix-Domain-Browser
● Demo:
![Page 14: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/14.jpg)
Fenix FrameworkChanges
● Edit domain_model.dml.● Run mvn clean test -PSQLUpdateGenerator● Edit /etc/database_operations/updates.sql● Rename updates.sql● Edit /etc/database_operations/run● Run /etc/database_operations/run
![Page 15: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/15.jpg)
⚠BE CAREFUL!
![Page 16: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/16.jpg)
Fenix FrameworkDumps
● Goto:○ https://fenix-ashes.ist.utl.pt/jenkins/
● Demo
![Page 17: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/17.jpg)
MySQL
● You are going to run the database in a remote server.
● How to connect:○ ssh -A -fNg -L <localport>:localhost:3306
○ mysql -h localhost -u<istid> --protocol=TCP -P <localport> -p<dbpass> <istid>_fenix -A
![Page 18: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/18.jpg)
MySQL
● Edit fenix-framework.properties:○ dbAlias=//localhost:<localport>/<istid>_fenix?
useUnicode=true&characterEncoding=utf8&clobCha
racterEncoding=utf8&zeroDateTimeBehavior=convertToNull
○ dbUsername=<istid>○ dbPassword=<dbpass>
![Page 19: Training: Day Three - Persistence](https://reader033.vdocuments.mx/reader033/viewer/2022051513/546f1d73af79596c298b597a/html5/thumbnails/19.jpg)
So, how do you change your marks?