SR-JRC | a java richclient framework |
| Longterm memoryA graphical desktop application has quite different transaction boundaries than application services, which must be considered be part of a bigger transaction. Desktop applications are the outermost part of a transaction So there's not reason to accept With SR-JRC plenty of Anyway - a developer must know about the existance of TransactionFactory taFactory = ApplicationServiceProvider.getService(TransactionFactory.class); Transaction ta = taFactory.createTransaction(); ta.add(new TOSave TransactionFactory taFactory = ApplicationServiceProvider.getService(TransactionFactory.class); Transaction ta = taFactory.createTransaction(); ta.add(new TOSave The responsibility of an <bean id="repository" class="de.schwarzrot.data.access.Repository"> <property name="exporter" ref="entityExporter" /> <property name="importer" ref="entityImporter" /> <property name="managers"> <map> <entry key="de.schwarzrot.app.config.support.AbstractConfigBase" value-ref="prefsEntityManager" /> <entry key="de.schwarzrot.data.VdrEntity" value-ref="vdrEntityManager" /> <entry key="de.schwarzrot.data.Entity" value-ref="jdbcEntityManager" /> <entry key="java.lang.Object" value-ref="baseEntityManager" /> </map> </property> </bean> Entity at any time without having to care about your application setup. The responsibility is clear and deterministic:
AbstractConfigBase and VdrEntity are decendants of Entity - and they all are java.lang.Object - obviously! So on determine the responsibility its evident to take ancestry into account. SR-JRC offers this at no extra charges :) VdrAssistant contains 3 different One of such a special case is maintaining a proprietary system en parallel to a SQL-database. All read access can be handled by the SQL-database, but each write-access has to be duplicated so the SQL-database stores the record, as well as the proprietary system. Talking about VdrAssistant, the interface to the proprietary system is a proprietary TCP/IP protocol and the The application does not need to know anything about the dualism. It treats a There exists 2 types of transactions: read- and write-transactions. Write-transactions have already been introduced above. read-transactions could save a lot of resources, so if you know it in advance ... tell the Have a look at this example, where the job-processor reads the recording it needs to transform: Transaction ta = taFactory.createTransaction(); TORead<Recording> tor = new TORead<Recording>(Recording.class); tor.addCondition(new EqualConditionElement("id", job.getSubject())); tor.setReadRelated(true); ta.add(tor); ta.setRollbackOnly(); ta.execute(); if (tor.getResult() != null && tor.getResult().size() > 0) { job.setSubject(tor.getResult().get(0)); } One of the goals of SR-JRC is for sure the fact, that you can decide by API usage whether you'd like to resolve references or not. Creating the condition shows the fact, that After executing the transaction the job-processor checks, whether the read operation was successful and returned a result. If so, the subject will be replaced by the received instance. SR-JRC supports these transation operations:
Many values have different representation in java world and outside (database or file). Therefore the data access layer uses translation helpers, whenever a value is read or written. Such translation helpers are of type The interface of translation helpers is defined as: public interface Converter { public Object fromPersistence(Class> type, Object value); public Class> getValueType(); public Object toPersistence(Object value, int physicalSize); } fromPersistence you'll need to specify "type", the type of the property in java world. toPersistence does not need any type information, but it could be necessary to cut the given value to fit into database fields. |