aspose file tools
The moose likes Object Relational Mapping and the fly likes Internal Exception: java.sql.SQLException: Invalid object name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Internal Exception: java.sql.SQLException: Invalid object name" Watch "Internal Exception: java.sql.SQLException: Invalid object name" New topic
Author

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

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 749
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 ]

SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10425
    
175

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.


[My Blog] [JavaRanch Journal]
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 749
Hi! I changed

@GeneratedValue(strategy=GenerationType.AUTO)

to

@GeneratedValue(strategy=GenerationType.IDENTITY)

and it worked! Weird eh?
Paul Scarrone
Greenhorn

Joined: Jan 19, 2011
Posts: 1

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
 
subject: Internal Exception: java.sql.SQLException: Invalid object name