Spring + Hibernate - tworzenie obiektow

0

Witam,
tak jak w temacie mam problem z tworzeniem nowego obiektu w javie danych, przy probie wywolania perista leci mi:

SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [/webstore] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'condition, description, discontinued, manufacturer, name, unitPrice, unitsInOrde' at line 1

ProductData

@Entity
@Table(name = "Product")
public class ProductData {

        @Id
	@Column(name = "id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;

	@Column(name = "code")
	private String code;

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

	@Column(name = "unitPrice")
	private Integer unitPrice;

	@Column(name = "description")
	private String description;

	@Column(name = "manufacturer")
	private String manufacturer;

	@Column(name = "category")
	private String category;

	@Column(name = "unitsInStock")
	private long unitsInStock;

	@Column(name = "unitsInOrder")
	private long unitsInOrder;

	@Column(name = "discontinued")
	private boolean discontinued;

	@Column(name = "condition")
	private String condition;

Konfiguracja hibernate:

	Properties additionalProperties() {
		Properties properties = new Properties();
		properties.setProperty("hibernate.id.new_generator_mappings", "false");
		properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
		return properties;
	}
0

Błąd mówi że używasz złego dialektu dla swojej bazy.

0

ale przeciez mam dialect ustawiony na MySQL i baze tez mam mySQL

0

MySQL5Dialect a ty pewnie masz inną wersje MySQLa zainstalowaną...

0

W phpMyAdmin jest napisane że:
Wersja serwera: 10.0.17-MariaDB - mariadb.org binary distribution

czyli na jakie dialect mam zmienic ?

0

org.hibernate.dialect.MySQLDialect

0

Probowałem tego i nadal to samo

0

MariaDB jest w 100% kompatybilne z MySQL, więc powinno śmigać. Sprawdź wszystko ze dwa razy jeszcze.

Jakiego drivera używasz? Tego? http://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client

0

używam tego:
http://mvnrepository.com/artifact/mysql/mysql-connector-java

ale jak dodałem ten który mi wysłałes to dalej jest to samo

0

rozwiązałem problem, była nim nazwa "condition" która jest zastrzezona w mySQL, wystarczyło zmienić nazwe pola i teraz działa

1 użytkowników online, w tym zalogowanych: 0, gości: 1