it.unimi.dico.islab.idbs2.kc.session
Class KCManager

java.lang.Object
  extended by it.unimi.dico.islab.idbs2.kc.session.KCManager

public class KCManager
extends Object

Manages object saving and querying for KnowledgeChunk wrapper. This class contains most used interrogations (such as getKnowledgeChunkById and methods for saving an object of this class.

IMPORTANT: this class has no public constructor. A singleton instance of this class is contained in KCSessionManager class

Author:
Vegeziel

Method Summary
protected static KCManager getKCManager()
           
 KnowledgeChunk getKnowledgeChunkById(String id)
          Used to load a KnowledgeChunk instance from the database.
 void saveOrUpdate(KnowledgeChunk kc)
          Give persistence to the given KnowledgeChunk object using associated Hibernate mappings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getKCManager

protected static KCManager getKCManager()

getKnowledgeChunkById

public KnowledgeChunk getKnowledgeChunkById(String id)
Used to load a KnowledgeChunk instance from the database. This method uses the internal Session Factory of this class (different from the one obtained calling the getSessionFactory method.

Parameters:
id - the identifier of a Knowledge Chunk.
Returns:
the Knowledge Chunk having id as primary key value.

saveOrUpdate

public void saveOrUpdate(KnowledgeChunk kc)

Give persistence to the given KnowledgeChunk object using associated Hibernate mappings.

This method executes the saveOrUpdate method of the Hibernate Session using internal Session Factory of KCSessionManager. As the KnowledgeChunk is the main class of this package, by saving this object a cascade save is started for all connected objects (predicates and all referred kcs, types, terms, documents and documentextractions).