Hi forum,
I am importing stock quotes data using HibernateTemplate + SpringFramework
Format of the data
AAPL,09-Jun-2010 09:00,251.47,251.47,251.39,251.39,640
AAPL,09-Jun-2010 09:01,251.4,251.4,251.05,251.26,6844
INTC,09-Jun-2010 09:00,251.47,251.47,251.39,251.39,640
INTC,09-Jun-2010 09:01,251.4,251.4,251.05,251.26,6844
MSFT,09-Jun-2010 09:00,251.47,251.47,251.39,251.39,640
MSFT,09-Jun-2010 09:01,251.4,251.4,251.05,251.26,6844
I have one Entity class called Stock
@Entity
public class Stock implements Serializable {
public Stock() {}
private Long id;
private BigDecimal open;
.... close,high, low..etc
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
....
My problem with this setup is that hibernate will put everything into a table called "Stock".
I want to separate different stock into a different table, so with the data above I will end up having 3 tables (AAPL, MSFT, INTC)
Is there an easy way to do this without resorting to hand-written sql statement in Hibernate/HibernateTemplate? sort of creating the table dynamically?
Environment:
- Mysql, Hibernate3.5.3, springframework3.0
http://stackoverflow.com/questions/3217 ... e-template