Hi everyone, I am trying to index many tables on my project, currently all DB tables (All entities extend AbstractRecord) have as primary key an identity column populated with the
generate_unique function. However since I have several tables and these column numbers will repeat amongst the tables when doing a search through Hibernate I will get class object instantiation exceptions.. Therefore I need to preserve the primary_key generation as it is, but have a unique identifier for all rows for all tables of my DB using the @DocumentId on a different property than the primary key itself.
Find in the following what I am trying to do:
Code:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class AbstractRecord
implements Serializable
{
//~ Instance variables ---------------------------------------------------------------
/** SERIALID */ public static final String SERIALID = "hyzmfgSwl5hsDbxZIitNILMT2/eiPYJErJcqIMun3/PVy3SbbiQie4k9lLnL450BhwL8EnUMyc+wrhgZtUBTdG9/YUuJ+ni/FRAdRGzTy7UrQI7opbrYRYehDUwj3hg9";
/** id for this record. */
@Id <------------------------------------------------------------------------------------------------------------------------
@GeneratedValue(strategy = GenerationType.TABLE)
@Column(name = "id", nullable = false)
private Integer id;
/** line number for this record. */
@Field(index=Index.UN_TOKENIZED, store=Store.NO)
@Column(name = "record_number", nullable = false)
private Integer recordNumber;
/** record types for this record. */
@Field(index=Index.UN_TOKENIZED, store=Store.NO)
@Column(name = "record_type", nullable = false)
private Integer recordType;
/** Current status for this record. */
@Field(index=Index.UN_TOKENIZED, store=Store.NO)
@Column(name = "record_status", nullable = false)
@Enumerated(EnumType.ORDINAL)
private RecordStatus recordStatus;
/** unique table key for the file. */
@Field(index=Index.UN_TOKENIZED, store=Store.NO)
@Column(name = "unique_table_key", nullable = false)
private String uniqueTableKey;
@DocumentId <------------------------------------------------------------------------------------------------------------------------ // Possible????
@Field(index=Index.UN_TOKENIZED, store=Store.YES)
@Column(name = "row_id", nullable = false)
private String rowId;
// Getters, setters, etc...
When performing the indexation and later search of documents the results are 0, however when I return the documentId annotation to the "id" property the results are retrieved, however for particular searches I get the exception mentioned above.. Any help/ideas/suggestions?
Thanks