I try to read from an existing table in a MSSQL Server 2016 Database. If I validate (hbm2ddl.auto --> validate) I get an Exception "Schema-validation: missing table".
I compared the generated Hibernate SQL Code (if I switch from validate to update with the SQL Code which I can generate in MSSQL Server itself. It looks equal:
-- generated SQL from Hibernate
create table Artikel (
Artnr int not null,
Artgruppe CHAR(5),
Bezeichnung VARCHAR(30) not null,
EPreis money,
primary key (Artnr)
)
-- generated SQL from MSSQL Server 2016
CREATE TABLE [dbo].[Artikel](
[Artnr] [int] NOT NULL,
[Bezeichnung] [varchar](30) NOT NULL,
[EPreis] [money] NULL,
[Artgruppe] [char](5) NULL,
PRIMARY KEY CLUSTERED
(
[Artnr] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
The Java-Model is:
@Entity
@Table(name = "Artikel")
public class Article {
@Id
@Column(name = "Artnr", nullable=true)
private int article_id;
@Column(name = "Bezeichnung", columnDefinition="VARCHAR(30)", nullable=false)
private String description;
@Column(name = "EPreis", columnDefinition = "money", nullable=true)
private BigDecimal price;
@Column(name = "Artgruppe", columnDefinition="CHAR(5)")
private String article_group;
// getters and setters
// ... not shown here
}
So what is the problem? Maybe it has something to do with the money type?
Thanks and regards