1

I have the following hibernate entity:

@Table(name="tbl_template")
@Entity
@Audited
public class StatementTemplate {
    private Long id;
    @Column(name = "template_name")
    private String templateName;
    ...

}

I changed the column name from template_name to stmt_name

@Column(name = "stmt_name")
private String templateName;

It turned out that the instead of changing the column name hibernate added another column named stmt_name, now I have template_name as well as stmt_name

I have following hibernate properties set up

<prop key="hibernate.hbm2ddl.auto">update</prop>

How can I get the column altered from template_name to stmt_name?

tintin
  • 5,676
  • 15
  • 68
  • 97

1 Answers1

-1

Stopping your app, running ALTER TABLE, and starting the app again?

milan
  • 11,872
  • 3
  • 42
  • 49
  • Not too sure abt your question here, but I have restarted the app, but I do I need to alter the table using ALTER TABLE sql command? Won't it be done automatically? – tintin Jan 01 '12 at 20:26
  • yes, good old SQL :) I'm not sure about hibernate but would guess it doesn't track renames. – milan Jan 01 '12 at 20:29