Christian Brensing, Senior Developer, State of Bavaria
The Bavarian government runs a document template application (RTF or ODF with Groovy, Python, Ruby or Tcl as scripting language) serving different government offices. Having complex and hierarchical data structures to organize the templates, MongoDB was selected to replace the Oracle-based persistence layer. In this talk you will hear about the improvements we have achieved with the migration to MongoDB, problems we had to solve underway and unit testing of the persistence layer in order to keep our quality level.
3. • Template-Processor (~ JSP)
• ODF and RTF
• PDF / PostScript postprocessing
• Groovy, Python, Ruby, Tcl
• In Production using RDBMS
since 2008
• Central HR system (SAP) uses
BayText to create output
18. public class RoleReadConverter implements Converter<DBObject, Role> {!
@Override!
public Role convert(DBObject source) {!
Role role = new Role();!
role.setName((String) source.get("name"));!
...!
return role;!
}!
}!
!
!
public class RoleWriteConverter implements Converter<Role, DBObject> {!
@Override!
public DBObject convert(Role source) {!
return new BasicDBObject()!
.append("name", role.getName())!
.append(...);!
}!
}!
!
!
// Convert a DBObject to an Entity!
conversionService.convert(collection.findOne(...));
Easy mapping using Spring-ConversionService
25. But paths are mutable!
All references must be updated
26. Approach
• Pseudo-Transaction with an update locking
mechanism in a custom oplog collection
• Periodical repair jobs finishing failed operations
• Extended interpretation of eventual consistency
35. Summary
• Developing the data layer is fun again
• Reduced complexity
• Flat learning curve compared to SQL/ORM
• use_mongo() unless transactions_required