Small fix from Zell.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2160 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2007-08-07 18:05:49 +00:00
parent df61cc8cf3
commit ec68201645
@@ -72,7 +72,6 @@ public class DepotMarshaller<T extends PersistentRecord>
public DepotMarshaller (Class<T> pclass, PersistenceContext context) public DepotMarshaller (Class<T> pclass, PersistenceContext context)
{ {
_pclass = pclass; _pclass = pclass;
Entity entity = pclass.getAnnotation(Entity.class); Entity entity = pclass.getAnnotation(Entity.class);
// see if this is a computed entity // see if this is a computed entity
@@ -559,9 +558,10 @@ public class DepotMarshaller<T extends PersistentRecord>
} }
}); });
final Entity entity = _pclass.getAnnotation(Entity.class);
// if the table does not exist, create it // if the table does not exist, create it
if (!metaData.tableExists) { if (!metaData.tableExists) {
final Entity entity = _pclass.getAnnotation(Entity.class);
final String[] fDeclarations = declarations; final String[] fDeclarations = declarations;
final String[][] fUniqueConstraintColumns = uniqueConstraintColumns; final String[][] fUniqueConstraintColumns = uniqueConstraintColumns;
@@ -583,9 +583,11 @@ public class DepotMarshaller<T extends PersistentRecord>
fUniqueConstraintColumns, primaryKeyColumns); fUniqueConstraintColumns, primaryKeyColumns);
// add its indexen // add its indexen
for (Index idx : entity.indices()) { if (entity != null) {
liaison.addIndexToTable( for (Index idx : entity.indices()) {
conn, getTableName(), idx.columns(), idx.name(), idx.unique()); liaison.addIndexToTable(
conn, getTableName(), idx.columns(), idx.name(), idx.unique());
}
} }
if (_keyGenerator != null) { if (_keyGenerator != null) {
_keyGenerator.init(conn, liaison); _keyGenerator.init(conn, liaison);
@@ -705,7 +707,6 @@ public class DepotMarshaller<T extends PersistentRecord>
}); });
} }
Entity entity = _pclass.getAnnotation(Entity.class);
// add any missing indices // add any missing indices
for (final Index index : (entity == null ? new Index[0] : entity.indices())) { for (final Index index : (entity == null ? new Index[0] : entity.indices())) {
if (metaData.indexColumns.containsKey(index.name())) { if (metaData.indexColumns.containsKey(index.name())) {