Document index use.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4808 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Par Winzell
2007-08-07 18:11:30 +00:00
parent a6be47fa83
commit 1eda45d8c8
3 changed files with 4 additions and 3 deletions
@@ -67,11 +67,10 @@ public class ConfigRecord extends PersistentRecord
@Column(name="NODE", length=64) @Column(name="NODE", length=64)
public String node; public String node;
/** The code of the stat. */
@Id @Id
@Column(name="OBJECT", length=128) @Column(name="OBJECT", length=128)
public String object; public String object;
@Id @Id
@Column(name="FIELD", length=64) @Column(name="FIELD", length=64)
public String field; public String field;
@@ -52,6 +52,7 @@ public class ConfigRepository extends DepotRepository
throws PersistenceException throws PersistenceException
{ {
HashMap<String,String> data = new HashMap<String,String>(); HashMap<String,String> data = new HashMap<String,String>();
// INDEX: Left-most primary key fields.
Where where = new Where(ConfigRecord.OBJECT_C, object, ConfigRecord.NODE_C, node); Where where = new Where(ConfigRecord.OBJECT_C, object, ConfigRecord.NODE_C, node);
for (ConfigRecord record : findAll(ConfigRecord.class, where)) { for (ConfigRecord record : findAll(ConfigRecord.class, where)) {
data.put(record.field, record.value.toString()); data.put(record.field, record.value.toString());
@@ -80,9 +80,10 @@ public class NodeRepository extends DepotRepository
public void deleteNode (String nodeName) public void deleteNode (String nodeName)
throws PersistenceException throws PersistenceException
{ {
// INDEX: Full primary key.
delete(NodeRecord.class, nodeName); delete(NodeRecord.class, nodeName);
} }
@Override // from DepotRepository @Override // from DepotRepository
protected void getManagedRecords (Set<Class<? extends PersistentRecord>> classes) protected void getManagedRecords (Set<Class<? extends PersistentRecord>> classes)
{ {