1

Anybody can tell what cause this error?

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 
Unknown column 'sequence_next_hi_value' in 'field list

I am connecting to a mysql database using hibernate. I was able to connect to the database and everything was working fine till I change the persistence.xml and added a datasource.

4
  • 1
    it means that this column sequence_next_hi_value was not found. it maybe because of your joins, (hard to tell). can you post your query? Commented Oct 23, 2012 at 13:20
  • Most likely you are running a query on a table that does not contain a column named sequence_next_hi_value Commented Oct 23, 2012 at 13:21
  • Could you post some of the coding? Commented Oct 23, 2012 at 13:41
  • Yes you are all right, this cloumn doesn exist. Thing is that it wasnt me that generated this column. Somehow it was auto-generated. It crashes only when I try an "insert" query. I think it has to do with the primary key. I m using the strategy=GenerationType.TABLE. What piece of code would it be helpful? Commented Oct 23, 2012 at 14:05

2 Answers 2

1

The problem is related to the used identifier generation type for your entities.

Make sure you've provided following annotations and parameters:

@GeneratedValue(strategy = GenerationType.TABLE, generator="name_of_the_generator")
@TableGenerator( name = "name_of_the_generator", table = "table_with_keys", pkColumnName = "PK_NAME", valueColumnName = "PK_VALUE")

My guess is that you have mixed valueColumnName with pkColumnValue.

Sign up to request clarification or add additional context in comments.

Comments

0

I have same problem , my solution is change GenerationType from @GeneratedValue strategy on Primary Keys to GenerationType.IDENTITY on hibernate 5 and MySQL as DB

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.