-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b47d46d
commit ed6b574
Showing
52 changed files
with
2,822 additions
and
910 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
self: play -> morphia 1.2.4 | ||
|
||
require: | ||
- play 1.2 |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
h1. The main concepts | ||
|
||
PlayMorphia plugin is a Object-MongoDB mapping tool integrated with Play!Framework. | ||
|
||
h2. <a name="arch">System architecture</a> | ||
|
||
Build on top of Play!framework plugin infrastructure and "Morphia":http://code.google.com/p/morphia/ library, PlayMorphia hides complexity and provides an easy-to-user interface to application developers for MongoDB access. | ||
|
||
!images/play-morphia-arch! | ||
|
||
h2. <a name="mongodb">Understand MongoDB</a> | ||
|
||
_"MongoDB (from 'humongous') is a scalable, high-performance, open source, document-oriented database.":http://www.mongodb.org_ | ||
|
||
Unlike traditional SQL databases, MongoDB's document oriented storage persist data in "JSON-style documents":http://bsonspec.org/ with "dynamic schemas":http://www.mongodb.org/display/DOCS/Schema+Design. | ||
|
||
h3. <a name="connection">Connection</a> | ||
|
||
"Connection":http://www.mongodb.org/display/DOCS/Connections is a concept used in classic client-server system. In our context, MongoDB provides server process; your application takes the client role. In order to access server(MongoDB) resources, your application needs to connect to server. | ||
|
||
p(note). In PlayMorphia, you configure the connection to MongoDB server with the @morphia.db.seeds@ configuration. See "here":start#database | ||
|
||
h3. <a name="database">Database</a> | ||
|
||
MongoDB use "databases":http://www.mongodb.org/display/DOCS/Databases to group a set of collections of data. A MongoDB server supports multiple databases. Each one of them are separate from each other, for security and ease of management. | ||
|
||
p(note). At the moment PlayMorphia supports mapping data model to only *one* database though you are free to configure multiple databases. To configure the database used in your application, you use @morphia.db.name@ configuration. See "here":start#database | ||
|
||
h3. <a name="collection">Collection</a> | ||
|
||
A "collection":http://www.mongodb.org/display/DOCS/Collections is roughly a table in traditional SQL database products. It groups a set of document(data) and (though not accurately) corresponds to a "Morphia Model":model#basic class in your application. | ||
|
||
By default PlayMorphia map your model class to the collection with the same name of the model class. E.g. suppose you have the following model class: | ||
|
||
bc. @Entity public class User extends Model {...} | ||
|
||
A collection named "*User*" will be created in your MongoDB database to store all the user document. However it is possible to specify a collection with different name. Let's say if I want the User class be mapped to a collection name "*profile*", I could do it in this way: | ||
|
||
bc. @Entity("profile") public class User extends Model {...} | ||
|
||
p(note). Click "here":annotation#entity for more information about the <code>@Entity</code> annotation. | ||
|
||
h3. <a name="document">Document</a> | ||
|
||
"Document":http://www.mongodb.org/display/DOCS/Documents is the way MongoDB call the record. The relationship between document and collection is just like that between row and table. | ||
|
||
In PlayMorphia, one document corresponds to an instance of your Model class. You can easily "create":crud#create, "read":crud#read, "update":crud#update and "delete":crud#update a document by invoking corresponding method built into your Model class. | ||
|
||
h2. <a name="morphia">Understand Morphia</a> | ||
|
||
Created by Mr. Scott Hernandez, _"“Morphia is a type-safe library for mapping Java objects to/from MongoDB”":http://code.google.com/p/morphia/_. | ||
|
||
The Morphia library is the cornerstone of PlayMorphia module, and it's also how this module is named. **Morphia** library provides the following functions in this module: | ||
|
||
# Mapping between Java Object and MongoDB document | ||
# Query interface | ||
|
||
Most interfaces/tools provided with Morphia have been carefully encapsulated or exposed in PlayMorphia in a way that make the programmer feel easy and comfortable. Actually it's hard for you to aware that you are using Morphia or any other tools. Like other stuff in Play, things just happen naturally. | ||
|
||
p(note). An interesting question is "Can I use Morphia directly in my Play application?". Yes you can. But before you go ahead with that way, make sure you have read "Why PlayMorphia":why. | ||
|
||
h2. <a name="play">PlayMorphia, seamless integration of MongoDB access into Play!Framework</a> | ||
|
||
MongoDB is wonderful, Morphia is nice, Play is amazing. PlayMorphia bring you a way to integrate these cool stuff together. With PlayMorphia module, writing code with MongoDB as backend in Play is not only easy but also fun! | ||
|
||
# "Simple configuration":start#simple | ||
# Automatically mapping model classes | ||
# DB access methods built into your model class | ||
# Transparent GridFS support | ||
# Clear entity lifecycle event handling | ||
# Powerful statistics in simple interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
Updates in 1.2.4 | ||
* Improved GridFS access performance | ||
* Support GridFS delete on both query delete and model entity delete | ||
* Support new lifecycle annotations for better performance | ||
* Fix bug in Yabe sample admin view | ||
* Rewrite documentation | ||
|
||
Updates in 1.2.3d | ||
* Fix bug: NullPointerException to fetch blob field before an new field saved | ||
|
||
Updates in 1.2.3c | ||
* Create index on _created and _modified fields for models annotated with @AutoTimestamp | ||
|
||
Updates in 1.2.3beta1 | ||
* Support aggregation operations: max,min,sum,average,count and their group peers | ||
* Support connecting to replica set. Thanks https://github.com/taligent for his contribution | ||
* Supports custom keys to find relations by ID. Thanks https://github.com/zash80 for his contribution | ||
|
||
Updates in 1.2.2beta1 | ||
* This is an important and purely community driven release which includes the following updates: | ||
** Support GridFS, thanks Alexander Reelsen (alr@emplify.de) for his contribution! | ||
** Added a morphiaFixture tag. This allows models to be loaded and deleted from within Selenium test cases. Thanks Agile Consulting (http://www.agileconsulting.biz) for their contribution | ||
** Bug fix: Choices list for Reference Collection was always empty. Thanks Lepnio (https://github.com/lepnio) for his contribution | ||
|
||
Updates in 1.2.1beta6 | ||
* Fix bug: IllegalStateException of "User defined ID should be populated before persist" when saving a subtype model with @Id fields defined in parent type | ||
|
||
Updates in 1.2.1beta5 | ||
* Add disableValidation() to Model. This is useful when your different subtype model have different fields | ||
* Add @NoId annotation. This help to resolve issue discussed in https://groups.google.com/forum/#!topic/play-framework/hPWJCvefPoI/discussion | ||
|
||
Updates in 1.2.1beta4 | ||
* Upgrade morphia to 1.0-snapshot and mongo lib to 2.6.1 | ||
|
||
Updates in 1.2.1beta3 | ||
* Limited support for multiple mongodb databases | ||
|
||
Updates in 1.2.1beat2 | ||
* "test" db used if no database configured and a warning issued | ||
* clear idCache when calling MorphiaFixtures.deleteX | ||
* support auto timestamp | ||
|
||
Updates in 1.2.1beta1 | ||
* Make it compatible with play-1.2.x | ||
|
||
Updates in 1.2beta-6 | ||
* Support filter (where clause) in Model.Factory.count and Model.Factory.fetch | ||
* Add @Global annotated ObjectIdBinder to app. This could fix issue #5 | ||
* Revert morphia library to 0.99-Snapshot as a workaround for issue #16 | ||
|
||
Updates in 1.2beta-5: | ||
* Fix issue: https://github.com/greenlaw110/play-morphia/issues#issue/12 | ||
* Support simple where clause in MorphiaPlugin.MorphiaModelLoader.fetch|count | ||
|
||
Updates in 1.2beta-4: | ||
* morphia lib updated to 0.99 release | ||
* mongo driver updated to 0.24 release | ||
|
||
Updates in 1.2beta-3: | ||
* Fixed issues: 7,8,9, see http://github.com/greenlaw110/play-morphia/issues | ||
* Add new configuration: morphia.defaultWriteConcern | ||
|
||
Updates in 1.2beta-2: | ||
* Fix bug: Play reload cause MappingException (https://github.com/greenlaw110/play-morphia/issues#issue/6) | ||
* Supress some debug information (change debug to trace) in MorphiaEnhancer and MorphiaPlugin | ||
|
||
Updates in 1.2beta: | ||
* Upgrade Morphia Library to 0.99-SNAPSHOT, mongodb driver to 2.3 | ||
* Better generic support in Model query methods. Now you don't need type cast for methods return a of entities. But if you use field or criteria in your expression, type cast is still needed | ||
* Support new Or query interface which is released since morphia-0.97 | ||
|
||
Note using Long as IdType (configured with "morphia.id.type") and you have @Reference annotation in your model entities, then you will be in trouble. Check <a href="http://groups.google.com/group/morphia/browse_thread/thread/bdd51121c2845973">this</a> thread for detail. Yabe sample has been updated and now use ObjectId as ID type for the same reason | ||
|
||
Known Issues: | ||
1. <a href="https://github.com/greenlaw110/play-morphia/issues/issue/5">StackOverflowError with unbind</a> | ||
2. <a href="https://github.com/greenlaw110/play-morphia/issues/issue/6">Play reload cause MappingException</a> | ||
|
||
Updates in 1.1d: | ||
* Fix bug: Play reload cause MappingException (https://github.com/greenlaw110/play-morphia/issues#issue/6) | ||
* Supress some debug information (change debug to trace) in MorphiaEnhancer and MorphiaPlugin | ||
|
||
Updates in 1.1c: | ||
* Fix bug in MorphiaFixture: delete(Class<Model>) -> delete(Class<? extends Model) | ||
|
||
Updates in 1.1b: | ||
* Yabe unit test passed | ||
* Add isNew() method to Model | ||
* Model.save() now return Model object which is comply to JPAModel; Use Model.save2() to return Key<Model> | ||
|
||
Updates in 1.1a: | ||
* Fix problems with User defined @Id field | ||
* Add information to document on how to create user defined @Id field entity | ||
|
Oops, something went wrong.