File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Internal Exception: java.sql.SQLException: Invalid object name

 
Timothy Sam
Ranch Hand
Posts: 751
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys! Whenever I'm trying to INSERT something to the database I get this error.


Internal Exception: java.sql.SQLException: Invalid object name 'SEQUENCE'.Error Code: 208 Call:UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [50, SEQ_GEN] Query ataModifyQuery()


But when I try to edit/delete existing data everything works fine...

I'm using JPA with Toplink as my persistence manager. Here's my model



I don't want to blame SQLServer 2005 yet. Could you guys please help me determine the source of the problem? Thanks!
[ May 02, 2007: Message edited by: Timothy Sam ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I might be way off target, but going by the error message it looks like the query is being fired for auto generating the ids when inserting an object. However, as far as i know, "SEQUENCE" is an Oracle specific construct and might not work for SQLServer. I am surprised why this query is getting generated for SQLServer.
 
Timothy Sam
Ranch Hand
Posts: 751
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! I changed

@GeneratedValue(strategy=GenerationType.AUTO)

to

@GeneratedValue(strategy=GenerationType.IDENTITY)

and it worked! Weird eh?
 
Paul Scarrone
Greenhorn
Posts: 1
Eclipse IDE Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The odd thing about it was the @GeneratedValue(strategy=GenerationType.AUTO) worked for a number of builds until I changed one of my controllers and then it start to pull SEQUENCE instead of IDENTITY.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic