Reputation: 457
I am trying to set up a table using JPA on HANA DB.
I would like to set the table as a column store (the default is row store).
Asking for your assistance, finding the annotation in order to set the table using the code instead of changing it manually every time.
Thanks.
Here is a sample of my code:
@Entity
@Table(name = "ACCOUNT")
@IdClass(Account.class)
@Data
public class Account {
@Id
@Column(name = "NAME", length = 32)
protected String landscape;
@Id
@Column(name = "ACCOUNT", length = 32)
protected String accountName;
}
Upvotes: 0
Views: 320
Reputation: 10396
An alternative option would be to change the default table type from row
to column
.
This can be done by setting the parameter default_table_type
in the sql
-section of the indexserver.ini
config file.
While the delivered default setting is row
for SAP HANA 1 and for SAP HANA 2 up to SPS2, SAP changed the delivered default setting to column
in SAP HANA 2 SPS3.
Upvotes: 0
Reputation: 457
After a short investigate, I found that I can't use JPA but I have another solution using Liquid-Base. Create change log and use the command of the column store:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="myapplication" id="myid">
<validCheckSum>ANY</validCheckSum>
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="TABLE_NAME"/>
</not>
</preConditions>
<sql>
ALTER TABLE SCHEMA.TABLE_NAME COLUMN
</sql>
</changeSet>
</databaseChangeLog>
Upvotes: 0
Reputation: 23246
It would appear that you can't. The document referenced at this link:
https://archive.sap.com/documents/docs/DOC-28976
notes that:
Column tables cannot be generated by JPA Entities as for now (no provider’s support Column table annotations yet).
Upvotes: 1