-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: dynamic-table-creation-in-hibernate-template
PostPosted: Sat Jul 10, 2010 12:08 am 
Newbie

Joined: Sat Jul 10, 2010 12:01 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.