- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
phoenix wide table, insert 1 row with 100 columns
- Labels:
-
Apache Phoenix
Created ‎07-01-2017 10:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using spring boot jdbc template connecting to a phoenix hbase database.
However, i have a table with 100 columns. so, everytime when i insert a row should contain 100 values
For example insert:
public void insert(Ttsnihl m){ Object[] params = new Object[]{ m.getPATIENT_ID(), m.getRECORD_DATE(), m.getSTART_TIME(), m.getEND_TIME(), .....// 100 object array }; jdbcTemplate.update(insertSql, params); }
And:
public void insertBatch(final List<Ttsnihl> ts){ BatchPreparedStatementSetter bpss = new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStatement ps, int i) throws SQLException { Ttsnihl t=ts.get(i); ps.setString(1, t.getPATIENT_ID()); ps.setTimestamp(2, t.getRECORD_DATE()); ps.setTimestamp(3, t.getSTART_TIME()); ps.setTimestamp(4, t.getEND_TIME()); ..... // 100 ps.set()functions } @Override public int getBatchSize() { return ts.size(); } }; jdbcTemplate.batchUpdate(insertSql, bpss); }
I want to ask, is there any smart way to do this?
Many thanks in advance!
Created ‎07-05-2017 03:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, if you need to store 100 columns per row, you need to set the values on the prepared statement for each row.
Created ‎07-05-2017 03:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, if you need to store 100 columns per row, you need to set the values on the prepared statement for each row.
