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
public abstract class AssociationContext { | |
private final List<String> selectableColumns; | |
public AssociationContext() { | |
this.selectableColumns = new ArrayList<String>(); | |
this.selectableColumns.add( "rows" ); | |
this.selectableColumns.add( "columns" ); | |
} | |
public List<String> getSelectableColumns() { |
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
public class MongoDBAssociationContext extends AssociationContext { | |
private List<String> loadingColumns; | |
@Override | |
public List<String> getLoadingColumns(){ | |
if(this.loadingColumns == null){ | |
this.loadingColumns = new ArrayList<String>(2); | |
this.loadingColumns.add( "rows" ); | |
this.loadingColumns.add( "columns" ); |
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
{ | |
"_id": { | |
"author": "Guillaume", | |
"title": "There are more than 20 JUGs in France" | |
}, | |
"content": "Great! Congratulations folks", | |
"labels": [] | |
} { | |
"_id": { | |
"news_author_fk": "Guillaume", |
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
{ | |
"_id": NumberLong(5), | |
"name": "statJUG", | |
"news_author_fk": "Guillaume", | |
"news_topic_fk": "There are more than 20 JUGs in France" | |
} |
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
public void updateTuple(Tuple tuple, EntityKey key) { | |
//all above | |
if(this.stack != null){ | |
this.stack.add( new Operation(idObject, updater) ); | |
} else { | |
this.getCollection( key ).update( idObject, updater, true, false ); | |
} | |
} |
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
<module xmlns="urn:jboss:module:1.1" name="org.hibernate.ogm.mongodb" slot="main"> | |
<resources> | |
<resource-root path="hibernate-ogm-mongodb-4.0.0-SNAPSHOT.jar" /> | |
<resource-root path="mongo-java-driver-2.9.0.jar" /> | |
</resources> | |
<dependencies> | |
<module name="org.hibernate" export="true" services="import" slot="ogm" /> | |
<module name="org.slf4j" /> | |
<module name="javax.api" /> |
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
<module xmlns="urn:jboss:module:1.1" name="org.hibernate" slot="ogm"> | |
<resources> | |
<resource-root path="hibernate-ogm-core-4.0.0-SNAPSHOT.jar" /> | |
</resources> | |
<dependencies> | |
<module name="org.hibernate" export="true" slot="main" /> | |
<module name="org.slf4j" /> | |
<module name="javax.api" /> | |
<module name="javax.persistence.api" /> |
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
final QueryBuilder queryBuilder = ftm.getSearchFactory().buildQueryBuilder().forEntity(Post.class).get(); | |
final org.apache.lucene.search.Query query = queryBuilder.keyword().onField("title").matching(title).createQuery(); | |
final Object result = ftm.createFullTextQuery(query, Post.class).getSingleResult(); |
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
<row> | |
<entry>hibernate.ogm.mongodb.writeconcern</entry> | |
<entry>Defines the write concern setting used to control the | |
acknowledgment of write operations. You can use: ERRORS_IGNORED, | |
ACKNOWLEDGED, UNACKNOWLEDGED, FSYNCED, JOURNALED, REPLICA_ACKNOWLEDGED, | |
NONE, NORMAL, SAFE, MAJORITY, FSYNC_SAFE, JOURNAL_SAFE, REPLICAS_SAFE. | |
For more information, please refer to the | |
<ulink href="http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html">official documentation</ulink> | |
This option is case insensitive and the default value is |
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
public static void main(String[] args) throws UnknownHostException { | |
MongoClient client = new MongoClient(); | |
DB devoxx = client.getDB("devoxx"); | |
DBCollection events = devoxx.getCollection("events"); | |
DBCursor dbObjects = events.find(); | |
for (DBObject dbObject : dbObjects) { | |
System.out.println(dbObject.get("name")); | |
} | |
} |