Training: Day Three - Persistence

Post on 18-Nov-2014

187 views 7 download

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 of Training: Day Three - Persistence

PersistenceSQL, Domain & Fenix Framework

How to change your gradesSQL, Domain & Fenix Framework

MySQL

Application Container (Tomcat, Jetty)

Fenix Framework(STM)

DomainModel

JSPrenderers

Struts

Faces

Jersey(REST API)

Fenix Framework

● Software Transactional Machine

● Developed in part by our Team

● Available at:○ https://github.com/fenix-framework/fenix-framework

Fenix Framework

class PendingRequest {

DateTime generationDate;

String url;

Boolean post;

String buildVersion;

}

relation PendingRequestRootDomainObject {

RootDomainObject playsRole rootDomainObject;

PendingRequest playsRole pendingRequest {

multiplicity *;

}

}

DML

Fenix FrameworkDML

valueType java.math.BigDecimal as BigDecimal {

externalizeWith {

String toString();

}

}

enum net.sourceforge.fenixedu.util.WeekDay as WeekDay;

Fenix Framework

Entity DomainObjectRootDomainObject

1 *

DML

Fenix Framework

class Degree extends AcademicProgram {

Double ectsCredits;

String nome (REQUIRED);

}

DML

Fenix Framework

@ConsistencyPredicate

private boolean checkRequiredSlots() {

ConsistencyChecks.checkRequired(this, "nome", getNome());

return true;

}

DML

Fenix FrameworkTransactions

● Use @Atomic

● Can be READ, WRITE, SPECULATIVE_READ

● DO NOT USE IN ACTIONS!

Fenix Framework

● /src/main/dml/domain_model.dml

● 1370 Entities, 1802 Relations, 54 Value Types & 200 Enums

DML

Fenix FrameworkFenix Domain Browser

● Available at:○ https://fenix-ashes.ist.utl.pt/fdb/

● Source code at:○ https://github.com/nurv/Fenix-Domain-Browser

● Demo:

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

⚠BE CAREFUL!

Fenix FrameworkDumps

● Goto:○ https://fenix-ashes.ist.utl.pt/jenkins/

● Demo

MySQL

● You are going to run the database in a remote server.

● How to connect:○ ssh -A -fNg -L <localport>:localhost:3306

mysqluser@fenix64bit.ist.utl.pt

○ mysql -h localhost -u<istid> --protocol=TCP -P <localport> -p<dbpass> <istid>_fenix -A

MySQL

● Edit fenix-framework.properties:○ dbAlias=//localhost:<localport>/<istid>_fenix?

useUnicode=true&characterEncoding=utf8&clobCha

racterEncoding=utf8&zeroDateTimeBehavior=convertToNull

○ dbUsername=<istid>○ dbPassword=<dbpass>

So, how do you change your marks?