词条 | Carbonado (Java) |
释义 |
| logo = | name = Carbonado | developer = Amazon.com | latest_release_version = 1.2.3 | latest_release_date = {{release date|2012|03|04}} | operating_system = Cross-platform (JVM) | platform = Java Virtual Machine | programming_language = Java | genre = Object-Relational mapping | license = Apache License 2.0 | website = [https://github.com/Carbonado/Carbonado github.com/Carbonado/Carbonado] }} Carbonado is an open source relational database mapping framework, written in Java. Rather than following a typical O/R mapping approach, the relational model is preserved, while still being object-oriented. Not being tied to specific features of SQL or JDBC, Carbonado also supports non-SQL database products such as Berkeley DB. In doing so, relational features such as queries and indexes are supported, without the overhead of SQL. HistoryCarbonado was originally developed for internal use by Amazon.com, as a revision to an earlier framework. It was released as an Apache licensed open-source project in October 2006.[1] Entity definitionsRelational entities are known as Storables in Carbonado, and they are defined by an interface or abstract class. Annotations are required to specify features which cannot be defined by Java interface alone. Every Storable must have an annotation describing the primary key of the entity. Carbonado Storables are not pure POJOs, and they must always extend the Storable superclass. By doing so, they gain access to various methods built into it. A Storable definition may also contain business logic, following the active record pattern. The actual implementation of the Storable is generated at runtime by Carbonado itself. The standard object methods of toString, equals and hashCode are also generated. This greatly simplifies the process of defining new entities, since no boilerplate code needs to be written. The process of loading a Storable by key starts by calling a factory method to create an uninitialized instance: Next, the key properties are set and load is called: Repository usageA Repository is a gateway to the underlying database. A few core implementations are available, which include:
In addition, composite Repositories exist which support simple replication and logging. All Repositories are created using a builder pattern. Each type of builder supports options specific to the Repository type. When a Repository instance is built, it only adheres to the standard interface. Access to specific features is provided by a Capability interface. Query executionCarbonado queries are defined by a simple filter expression and an order-by specification. Compared to SQL, the filter closely resembles a "where" clause. Filters can include joined properties and they may also include sub filters. This simple example queries for entities with a given message: TransactionsTransactions are created from a Repository instance, and they define a thread-local scope. Multiple persist operations are automatically grouped together, and commit must be called to complete the transaction. This design approach shows how Carbonado is not like an O/R mapping framework. Such frameworks typically hide the concept of transactions entirely, often by using sessions which track changes. In Carbonado, all actions are direct. Notes1. ^{{cite web |url=http://www.allthingsdistributed.com/2006/10/carbonado.html |title=Carbonado |last=Vogels |first=Werner |date=26 October 2006 |work=All Things Distributed |accessdate=25 December 2010}} External links
3 : Amazon (company)|Java platform software|Persistence |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。