Issue #1970 Fixes for Hibernate dataURI and indsertTime Index generation.
Amend: Removed Inheritance strategy from GridRecord. Removed dataURI_idx from PluginDataObject. Change-Id: If04f5388b339ffaafde1693917cf90a8512a1225 Former-commit-id:5683873c24
[formerly51a22d0146
] [formerlyb0bc5fc2c5
] [formerly5683873c24
[formerly51a22d0146
] [formerlyb0bc5fc2c5
] [formerly89464e243e
[formerlyb0bc5fc2c5
[formerly 82722bc34cb49b8934063ab6ebdcf66a9bcbe024]]]] Former-commit-id:89464e243e
Former-commit-id:2c286cbca9
[formerlyb9ba987cbe
] [formerly ab43aea7d7d22f7038a896d00f2afeda839cbd74 [formerly96332b9e63
]] Former-commit-id: fbac70d319eeb20cfd4d952a866bdfa91f4e3793 [formerly08715b2985
] Former-commit-id:cc691bf629
This commit is contained in:
parent
85f8f28521
commit
7c322531c0
6 changed files with 35 additions and 16 deletions
|
@ -50,8 +50,8 @@ import com.raytheon.uf.edex.database.DatabasePluginRegistry;
|
||||||
import com.raytheon.uf.edex.database.DatabaseSessionFactoryBean;
|
import com.raytheon.uf.edex.database.DatabaseSessionFactoryBean;
|
||||||
import com.raytheon.uf.edex.database.IDatabasePluginRegistryChanged;
|
import com.raytheon.uf.edex.database.IDatabasePluginRegistryChanged;
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterTask;
|
|
||||||
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
|
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
|
||||||
|
import com.raytheon.uf.edex.database.cluster.ClusterTask;
|
||||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||||
import com.raytheon.uf.edex.database.plugin.PluginVersion;
|
import com.raytheon.uf.edex.database.plugin.PluginVersion;
|
||||||
|
@ -67,6 +67,8 @@ import com.raytheon.uf.edex.database.plugin.PluginVersionDao;
|
||||||
* 10/8/2008 1532 bphillip Initial checkin
|
* 10/8/2008 1532 bphillip Initial checkin
|
||||||
* 2/9/2009 1990 bphillip Fixed index creation
|
* 2/9/2009 1990 bphillip Fixed index creation
|
||||||
* 03/20/09 njensen Implemented IPluginRegistryChanged
|
* 03/20/09 njensen Implemented IPluginRegistryChanged
|
||||||
|
* Mar 02, 2013 1970 bgonzale Updated createIndexTableNamePattern to match text preceeding
|
||||||
|
* %TABLE%.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author bphillip
|
* @author bphillip
|
||||||
|
@ -100,7 +102,7 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
|
||||||
.compile("^create (?:table |index |sequence )(?:[A-Za-z_0-9]*\\.)?(.+?)(?: .*)?$");
|
.compile("^create (?:table |index |sequence )(?:[A-Za-z_0-9]*\\.)?(.+?)(?: .*)?$");
|
||||||
|
|
||||||
private Pattern createIndexTableNamePattern = Pattern
|
private Pattern createIndexTableNamePattern = Pattern
|
||||||
.compile("^create index %TABLE%.+? on (.+?) .*$");
|
.compile("^create index \\w*?%TABLE%.+? on (.+?) .*$");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the singleton instance
|
* Gets the singleton instance
|
||||||
|
@ -294,8 +296,7 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
|
||||||
runPluginScripts(props);
|
runPluginScripts(props);
|
||||||
String database = props.getDatabase();
|
String database = props.getDatabase();
|
||||||
PluginVersion pv = new PluginVersion(props.getPluginName(),
|
PluginVersion pv = new PluginVersion(props.getPluginName(),
|
||||||
true,
|
true, props.getTableName(), database);
|
||||||
props.getTableName(), database);
|
|
||||||
pvd.saveOrUpdate(pv);
|
pvd.saveOrUpdate(pv);
|
||||||
logger.info(pluginName + " plugin initialization complete!");
|
logger.info(pluginName + " plugin initialization complete!");
|
||||||
} else if (initialized == false) {
|
} else if (initialized == false) {
|
||||||
|
@ -343,9 +344,6 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
|
||||||
createSql.add(sql);
|
createSql.add(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// only truly want the sql for just this plugin
|
|
||||||
removeAllDependentCreateSql(props, sessFactory, createSql);
|
|
||||||
|
|
||||||
for (int i = 0; i < createSql.size(); i++) {
|
for (int i = 0; i < createSql.size(); i++) {
|
||||||
String sql = createSql.get(i);
|
String sql = createSql.get(i);
|
||||||
if (sql.startsWith("create index")) {
|
if (sql.startsWith("create index")) {
|
||||||
|
@ -358,6 +356,9 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
|
||||||
}
|
}
|
||||||
createSql.trimToSize();
|
createSql.trimToSize();
|
||||||
|
|
||||||
|
// only truly want the sql for just this plugin
|
||||||
|
removeAllDependentCreateSql(props, sessFactory, createSql);
|
||||||
|
|
||||||
pluginCreateSql.put(fqn, createSql);
|
pluginCreateSql.put(fqn, createSql);
|
||||||
}
|
}
|
||||||
return createSql;
|
return createSql;
|
||||||
|
|
|
@ -23,13 +23,13 @@ import java.util.Collection;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Embedded;
|
import javax.persistence.Embedded;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
import javax.persistence.PrimaryKeyJoinColumn;
|
import javax.persistence.PrimaryKeyJoinColumn;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.Transient;
|
import javax.persistence.Transient;
|
||||||
import javax.persistence.UniqueConstraint;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
@ -59,15 +59,17 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* 20080221 862 jkorman Initial Coding.
|
* 20080221 862 jkorman Initial Coding.
|
||||||
* 02/06/09 1990 bphillip removed populateDataStore method
|
* 02/06/09 1990 bphillip removed populateDataStore method
|
||||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
||||||
|
* Mar 02, 2013 1970 bgonzale Removed Table annotation, changed from Entity
|
||||||
|
* annotation to MappedSuperClass.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@Entity
|
@MappedSuperclass
|
||||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "bufrmosseq")
|
@SequenceGenerator(name = PluginDataObject.ID_GEN)
|
||||||
@Table(name = "bufrmos", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
|
|
|
@ -21,12 +21,16 @@ package com.raytheon.uf.common.dataplugin.npp.sounding;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Embedded;
|
import javax.persistence.Embedded;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
import javax.xml.bind.annotation.XmlAttribute;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
|
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
|
||||||
|
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||||
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
|
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
|
||||||
import com.raytheon.uf.common.pointdata.IPointData;
|
import com.raytheon.uf.common.pointdata.IPointData;
|
||||||
|
@ -45,6 +49,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jan 3, 2013 mschenke Initial creation
|
* Jan 3, 2013 mschenke Initial creation
|
||||||
* Apr 12, 2013 1857 bgonzale Changed to MappedSuperclass.
|
* Apr 12, 2013 1857 bgonzale Changed to MappedSuperclass.
|
||||||
|
* Mar 02, 2013 1970 bgonzale Added SequenceGenerator and Inheritance Strategy
|
||||||
|
* annotations.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -52,6 +58,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
|
@SequenceGenerator(name = PluginDataObject.ID_GEN)
|
||||||
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
public abstract class NPPSoundingRecord extends PersistablePluginDataObject
|
public abstract class NPPSoundingRecord extends PersistablePluginDataObject
|
||||||
|
|
|
@ -41,6 +41,7 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
import org.apache.commons.beanutils.PropertyUtils;
|
import org.apache.commons.beanutils.PropertyUtils;
|
||||||
|
import org.hibernate.annotations.Index;
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||||
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
|
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
|
||||||
|
@ -78,6 +79,7 @@ import com.raytheon.uf.common.util.ConvertUtil;
|
||||||
* Mar 29, 2013 1638 mschenke Added methods for loading from data map and creating data map from
|
* Mar 29, 2013 1638 mschenke Added methods for loading from data map and creating data map from
|
||||||
* dataURI fields
|
* dataURI fields
|
||||||
* Apr 15, 2013 1868 bsteffen Improved performance of createDataURIMap
|
* Apr 15, 2013 1868 bsteffen Improved performance of createDataURIMap
|
||||||
|
* Mar 02, 2013 1970 bgonzale Moved Index annotation from getters to attributes.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -116,6 +118,7 @@ public abstract class PluginDataObject extends PersistableDataObject implements
|
||||||
|
|
||||||
/** The timestamp denoting when this record was inserted into the database */
|
/** The timestamp denoting when this record was inserted into the database */
|
||||||
@Column(columnDefinition = "timestamp without time zone")
|
@Column(columnDefinition = "timestamp without time zone")
|
||||||
|
@Index(name = "%TABLE%_insertTimeIndex")
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
@DynamicSerializeElement
|
@DynamicSerializeElement
|
||||||
protected Calendar insertTime;
|
protected Calendar insertTime;
|
||||||
|
|
|
@ -23,7 +23,10 @@ import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.MappedSuperclass;
|
import javax.persistence.MappedSuperclass;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
|
||||||
|
@ -42,6 +45,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
* Dec 16, 2008 chammack Initial creation
|
* Dec 16, 2008 chammack Initial creation
|
||||||
* Apr 8, 2013 1293 bkowal Removed references to hdffileid.
|
* Apr 8, 2013 1293 bkowal Removed references to hdffileid.
|
||||||
* Apr 12, 2013 1857 bgonzale Changed to MappedSuperclass.
|
* Apr 12, 2013 1857 bgonzale Changed to MappedSuperclass.
|
||||||
|
* Mar 02, 2013 1970 bgonzale Added SequenceGenerator and Inheritance Strategy
|
||||||
|
* annotations.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -49,6 +54,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
|
@SequenceGenerator(name = PluginDataObject.ID_GEN)
|
||||||
|
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
@DynamicSerialize
|
@DynamicSerialize
|
||||||
public abstract class PersistablePluginDataObject extends PluginDataObject
|
public abstract class PersistablePluginDataObject extends PluginDataObject
|
||||||
|
|
|
@ -40,7 +40,6 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||||
import org.hibernate.annotations.Index;
|
|
||||||
import org.hibernate.annotations.Type;
|
import org.hibernate.annotations.Type;
|
||||||
|
|
||||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||||
|
@ -61,6 +60,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
* Jim Ramer Original Code
|
* Jim Ramer Original Code
|
||||||
* Jun 18, 2007 chammack Partial port to Java
|
* Jun 18, 2007 chammack Partial port to Java
|
||||||
* Apr 12, 2013 1857 bgonzale Added Index annotations to getter methods.
|
* Apr 12, 2013 1857 bgonzale Added Index annotations to getter methods.
|
||||||
|
* Mar 02, 2013 1970 bgonzale Removed Index annotations.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -344,7 +344,6 @@ public class DataTime implements Comparable<DataTime>, Serializable,
|
||||||
/**
|
/**
|
||||||
* @return the refTime
|
* @return the refTime
|
||||||
*/
|
*/
|
||||||
@Index(name = "refTimeIndex")
|
|
||||||
public Date getRefTime() {
|
public Date getRefTime() {
|
||||||
return this.refTime;
|
return this.refTime;
|
||||||
}
|
}
|
||||||
|
@ -361,7 +360,6 @@ public class DataTime implements Comparable<DataTime>, Serializable,
|
||||||
/**
|
/**
|
||||||
* @return the fcstTime
|
* @return the fcstTime
|
||||||
*/
|
*/
|
||||||
@Index(name = "fcstTimeIndex")
|
|
||||||
public int getFcstTime() {
|
public int getFcstTime() {
|
||||||
return fcstTime;
|
return fcstTime;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue