-1

I refer to the professor's video to write my own Lab4 homework. But when I run the program, it prompts me that a syntax error is occur for mysql.

I checked my code with the professor's Sample code,But can't find the error.

In fact, there is not much difference between the business class that I created and the pet class which create by professor.

Now I know the reason, I think it is a very typical mistake, If you are not familiar with mysql, you may have the same problem as me.

So, IN the answer column, I'll share with you one thing need to notice when accessing the database using JPA

xzhu58
  • 1

1 Answers1

0

Mysql has keywords. (select,from,add,between...)

If a property in our business class has the same name as the keywords, Then there will be problems.

For my case, I created a bug ticket class. it has a field named rank (Used to distinguish the severity of a bug),but as you know Rank is also one of the mysql keywords.

That's why I'm reminded of syntax error,The problem was solved when I changed the property name from rank to bugRank.

xzhu58
  • 1