?
Solved

sequence error

Posted on 2014-04-22
4
Medium Priority
?
323 Views
Last Modified: 2014-04-28
hello,

I have a class with jpa annotation called WebdUserRight and have a controller which is below this class.. when i pass the code and description from a jsp it gives me  error as sequence does not exist as
The code breaks at the     "em.persist(webdUserRight);" with the above error. but i have
access rights of the sequence generator.. what could be the issue on this piece of code

[TopLink Warning]: 2014.04.23 09:09:07.875--ClientSession(4731775)--Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-02289: sequence does not exist

Error Code: 2289
Call: SELECT user_webdUser_seq.NEXTVAL FROM DUAL
Query: ValueReadQuery()

Open in new window


@Entity
@Table( name="user_webdUserRight")
public class WebdUserRight {
  
  @SequenceGenerator( name = "user_webdUser_seq", sequenceName = "user_webdUser_seq", allocationSize = 1 )
  @GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "user_webdUser_seq" )    
  @Id
  @Column
  private int webdUserRightKey;
  
  @Column
  private String code;
  
  @Column
  private String descrip;
  
 public String getCode() {
    return code;
  }

  public void setCode( String code ) {
    this.code = code;
  }

  public String getDescrip() {
    return descrip;
  }

  public void setDescrip( String descrip ) {
    this.descrip = descrip;
  }

  public int getWebdUserRightKey() {
    return webdUserRightKey;
  }

  public void setWebdUserRightKey( int webdUserRightKey ) {
    this.webdUserRightKey = webdUserRightKey;
  }

Open in new window


@Controller
public class RightsController {
@RequestMapping(value = "addRights")
		public String saverights(
				HttpServletRequest request, 
				HttpServletResponse response,
				@ModelAttribute("WebdUserRight") WebdUserRight webdUserRight,
				@RequestParam("code") String Strcode,
				@RequestParam("name") String Strname,
				Model model) {
			
			

		
		
			EntityManager em = DataAccess.emf.createEntityManager();
		
			
			try {
			
			
				em.getTransaction().begin();
			
				webdUserRight.setCode(Strcode);
				webdUserRight.setDescrip(Strname);
			
				
				em.persist(webdUserRight);
				em.getTransaction().commit();

				return "user/mainRights";
			} catch (Exception e) {
				return "failure";
			} finally {
				em.close();
			}
		}
		
  }
}			

Open in new window

0
Comment
Question by:roy_sanu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 40016900
Are you sure that a sequence with the name "user_webdUser_seq" exists in the database?
0
 

Accepted Solution

by:
roy_sanu earned 0 total points
ID: 40016975
schema.user_webdUser_seq was missing in the code it is working now

thanks
0
 
LVL 37

Expert Comment

by:zzynx
ID: 40016993
>> the code it is working now
Okay!
Kindly close this question.

>> thanks
You're welcome.
0
 

Author Closing Comment

by:roy_sanu
ID: 40026828
working after adding schema to the code
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month14 days, 20 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question