There is a duplicate for my question , but it has not yet been answered. I start hibernation by creating a table automatically from an object in SQL Server using the property
<property name="hibernate.hbm2ddl.auto">create</property>
it looks like the column order of the table is wrong, and that was not a problem for me until I used a compound key. Now the problem is that the column order is not the same as the business object. Here is the business object you created
@Entity
public class SalesEstimateDtl implements Serializable {
@Id
private Long LedSalesEstID;
@Id
private Integer LedSalesEstRowNo;
and here is the generated request
CREATE TABLE [dbo].[SalesEstimateDtl](
[LedSalesEstRowNo] [int] NOT NULL,
[LedSalesEstID] [numeric](19, 0) NOT NULL,
PRIMARY KEY CLUSTERED
(
[LedSalesEstRowNo] ASC,
[LedSalesEstID] ASC
) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
How can I change the order of LedSalesEstRowNo using LedSalesEstID?
source
share