Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:23:56+00:00 2026-06-07T01:23:56+00:00

I am having error when I use ejb3 and Postgres to insert data. But

  • 0

I am having error when I use ejb3 and Postgres to insert data. But using raw SQL it goes fine.

My table is:


CREATE SEQUENCE vmb_mails_seq;
CREATE TABLE vmb_mails ( ID BIGINT DEFAULT nextval('vmb_mails_seq') PRIMARY KEY, TITLE TEXT , FROM_ADDR VARCHAR(256), DATE_ARRIVED TIMESTAMP, BODY TEXT, ENT_BY NUMERIC(20,0), IS_DELETED NUMERIC(1,0), DELETE_DATE TIMESTAMP, MOD_BY NUMERIC(20,0), IS_ACTIVE NUMERIC(1,0), ENT_DATE TIMESTAMP, MOD_DATE TIMESTAMP, REACTIVE_DATE TIMESTAMP, INACTIVE_DATE TIMESTAMP ); ALTER SEQUENCE vmb_mails_seq OWNED BY vmb_mails.id;

ejb3 entity is:


@Entity
@Table(name="vmb_mails")
@SequenceGenerator(name="Mails_Seq_Gen",sequenceName="vmb_mails_seq",allocationSize=1)
public class Mail implements Serializable
{
    private long id;
    private String title;
    private String fromAddr;
    private Date dateArrived;
//  private Clob body;
    private String body;

    private long entBy;
    private int isDeleted;
    private Date deleteDate;
    private long modBy;
    private int isActive;   
    private Date entDate;
    private Date modDate;
    private Date reActiveDate;
    private Date inActiveDate;

    public Mail()
    {

    }
    @Id
    @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="Mails_Seq_Gen")
    @Column(name="ID")
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    @Column(name="TITLE")

    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Column(name="FROM_ADDR")

    public String getFromAddr() {
        return fromAddr;
    }
    public void setFromAddr(String fromAddr) {
        this.fromAddr = fromAddr;
    }
    @Column(name="DATE_ARRIVED")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getDateArrived() {
        return dateArrived;
    }
    public void setDateArrived(Date dateArrived) {
        this.dateArrived = dateArrived;
    }
    @Column(name="BODY")
    public String getBody()
    {
        return body;
    }
    public void setBody(String body)
    {
        this.body = body;
    }
    /*public Clob getBody() {
        return body;
    }
    public void setBody(Clob body) {
        this.body = body;
    }*/
    @Column(name="ENT_BY")

    public long getEntBy() {
        return entBy;
    }
    public void setEntBy(long entBy) {
        this.entBy = entBy;
    }
    @Column(name="IS_DELETED")

    public int getIsDeleted() {
        return isDeleted;
    }
    public void setIsDeleted(int isDeleted) {
        this.isDeleted = isDeleted;
    }
    @Column(name="DELETE_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getDeleteDate() {
        return deleteDate;
    }
    public void setDeleteDate(Date deleteDate) {
        this.deleteDate = deleteDate;
    }
    @Column(name="MOD_BY")

    public long getModBy() {
        return modBy;
    }
    public void setModBy(long modBy) {
        this.modBy = modBy;
    }
    @Column(name="IS_ACTIVE")

    public int getIsActive() {
        return isActive;
    }
    public void setIsActive(int isActive) {
        this.isActive = isActive;
    }
    @Column(name="ENT_DATE")
    @Temporal(TemporalType.TIMESTAMP)

    public Date getEntDate() {
        return entDate;
    }
    public void setEntDate(Date entDate) {
        this.entDate = entDate;
    }
    @Column(name="MOD_DATE")
    @Temporal(TemporalType.TIMESTAMP)

    public Date getModDate() {
        return modDate;
    }
    public void setModDate(Date modDate) {
        this.modDate = modDate;
    }
    @Column(name="REACTIVE_DATE")
    @Temporal(TemporalType.TIMESTAMP)

    public Date getReActiveDate() {
        return reActiveDate;
    }
    public void setReActiveDate(Date reActiveDate) {
        this.reActiveDate = reActiveDate;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="INACTIVE_DATE")

    public Date getInActiveDate() {
        return inActiveDate;
    }
    public void setInActiveDate(Date inActiveDate) {
        this.inActiveDate = inActiveDate;
    }

}

While calling entitmanager.persist(mail) I get this error:

at java.lang.Thread.run(Thread.java:662) Caused by: Exception
[EclipseLink-4002] (Eclipse Persistence Services -
2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException Internal
Exception: org.postgresql.util.PSQLException: ERROR: relation
"vmb_mails_seq" does not exist Position: 16 Error Code: 0 Call:
select nextval('vmb_mails_seq') Query: ValueReadQuery(sql="select
nextval('vmb_mails_seq')")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:23:57+00:00Added an answer on June 7, 2026 at 1:23 am

    You can simplify your DDL script with the use of a serial data type. bigserial in your case:

    CREATE TABLE vmb_mails (
      id bigserial PRIMARY KEY
    , title text,
      -- more columns
    );
    

    This creates a sequence named vmb_mails_id_seq automatically (in the same schema).
    Also note that sequences have separate privileges.

    GRANT INSERT ON vmb_mails TO ..
    

    Does not cover the sequence. Additionally you need:

    GRANT USAGE ON SEQUENCE vmb_mails_id_seq TO ..
    

    See:

    • Explicitly granting permissions to update the sequence for a serial column necessary?

    However, the error message says:

    relation "vmb_mails_seq" does not exist

    And that has some other cause. Did you actually check if the sequence is there? In the right database, at the right port, in the right schema?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a weird error thrown when I try to use @Secured or @PreAuthorize
I'm having a document.body is null error in my javascript because I use: $(window).width()
here is the part if having error. Fatal error: Using $this when not in
I'm having the error Data may still be loading. Drag or refresh the page
I am having this error in my j2ee web application. java.sql.SQLException: ORA-00604: error occurred
I'm currently having following error message when executing a .sql file with about 26MB
I tried to implement rtmps with red5 but was having an error that the
I deployed the web service, I created. But, I having an error when I
I'm having this error when I try to use wicked_pdf: irb: No such file
Having trouble when trying to create a class using another class(and 2 inner classes),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.