Skip to content

Commit

Permalink
Fix default table name to be based on entity name. Fixes #218
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjefferson committed May 24, 2017
1 parent f0f6516 commit 24ad55f
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,33 @@ public JPANamingFactory(NucleusContext nucCtx)
super(nucCtx);
}

/* (non-Javadoc)
* @see org.datanucleus.store.schema.naming.NamingFactory#getTableName(org.datanucleus.metadata.AbstractClassMetaData)
*/
public String getTableName(AbstractClassMetaData cmd)
{
String name = null;
if (cmd.getTable() != null)
{
name = cmd.getTable();
// TODO This may have "catalog.schema.name"
}
if (name == null)
{
if (cmd.getEntityName() != null)
{
name = cmd.getEntityName();
}
else
{
name = cmd.getName();
}
}

// Apply any truncation necessary
return prepareIdentifierNameForUse(name, SchemaComponent.TABLE);
}

/* (non-Javadoc)
* @see org.datanucleus.store.schema.naming.NamingFactory#getTableName(org.datanucleus.metadata.AbstractMemberMetaData)
*/
Expand Down

0 comments on commit 24ad55f

Please sign in to comment.