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 4107010
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:26:59+00:00 2026-05-20T21:26:59+00:00

I have an application that gathers a bit of it’s data using entities created

  • 0

I have an application that gathers a bit of it’s data using entities created with hibernat, The rest is gathered with a simple jdbc database connection and sql statements. Saving is also the same. I recently upgraded the database to Postgresql 9.0 from Postgresql 8.4 and noticed all data gathered with the entities does not display any more. I can save data with the entites, but can not display that same data.

I upgraded to Hibernate 3.6.2 with no fix, I also updated to the latest JDBC3 driver from postgresql 9.0-801. Neither of these fixed the issue.

Here is one of the entities that does work. I have not changed since the DB upgrade.

package com.ajrs.entities;

import java.io.Serializable;
import javax.persistence.*;  
import static javax.persistence.GenerationType.*;

@Entity
@Table(name="lk_note_category")
@NamedQueries({
@NamedQuery(
name="LkNoteCategory.getAll",
        query="SELECT l FROM LkNoteCategory l"
        )
})

public class LkNoteCategory implements Serializable {

@Id
private String category;    
private String description;
private boolean default_category;    

public String getCategory() {
    return category;
}

public void setCategory(String category) {
    this.category = category;
}

public String getDescription() {
    return description;
}

public void setDescription(String description) {
    this.description = description;
}

public boolean isDefault_category() {
    return default_category;
}

public void setDefault_category(boolean default_category) {
    this.default_category = default_category;
}

}

So I create the note categories object with the following:

noteCategories = em.createNamedQuery("LkNoteCategory.getAll").getResultList();

That one loads up and according to my netbeans debugger gets all categories.

Here is an entity that does not work.

enter code herepackage com.ajrs.entities;

import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import static javax.persistence.CascadeType.*;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.*;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Transient;

@Entity
@NamedQueries({
@NamedQuery(
name="Note.oldgetByClaimNo",
        query="select n from Note n where n.claimNo = :claim_no order by n.created"
        ),
        @NamedQuery(
name="Note.getByCategoryAndSubcategory",
        query="select n from Note n where n.claimNo = :claim_no and n.category = :category and n.subcategory = :subcategory order by n.created"
        )
})
@NamedNativeQuery(name="Note.getByClaimNo",
query=
    "select claim_no, userid, date, note, category, subcategory, note_id from "+
    "(      select 1 as ord1, extract (epoch from date) as ord2, claim_no, userid, date, note, category, subcategory, note_id "+
    "       from note " +
    "       where claim_no = :claim_no "+
    "       and(subcategory is null or category != 'VI') " +
    "       and date <= (select coalesce(min(date),'1/1/3999') " +
    "                    from note n2 " +
    "                    where n2.claim_no = note.claim_no " +
    "                      and (n2.subcategory is not null " +
    "                           and n2.category = 'VI')" +
    "                          ) "+
    "       union "+
    "       select 2 as ord1, sort_order as ord2, claim_no, userid, date, note, category, subcategory, note_id " +
    "       from(select note.*, sort_order " +
    "                from note inner join lk_note_subcategory using(subcategory) "+
    "                where claim_no = :claim_no "+
    "               and (note.subcategory is not null and " +
    "                        note.category = 'VI') "+
    "               ) as foo " +
    "       union " +
    "       select 3 as ord1, extract (epoch from date) as ord2, claim_no, userid, date, note, category, subcategory, note_id "+
    "       from note " +
    "       where claim_no = :claim_no "+
    "       and(subcategory is null or category != 'VI') " +
    "       and date > (select coalesce(min(date),'1/1/3999') " +
    "                    from note n2 " +
    "                    where n2.claim_no = note.claim_no " +
    "                      and (n2.subcategory is not null " +
    "                           and n2.category = 'VI')" +
    "                          ) "+
    ") as dummy " +
    "order by ord1, ord2"
    , resultClass=Note.class)


    public class Note implements Serializable {
public static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy=SEQUENCE, generator="NOTE_SEQUENCE_GENERATOR")
@SequenceGenerator(name="NOTE_SEQUENCE_GENERATOR", sequenceName="NOTE_NOTE_ID_SEQ")
private int note_id;

private String note;
private String userid;
@Column(name="claim_no")
private String claimNo;
@Column(name="date")
private Timestamp created;
private String category = "";
private String subcategory;

/* Transient properties */
@Transient
private boolean updated = false;

public String getUser() {
    return userid; }

public void setUser(String u) {
    userid = u;}

public String getNote() {
    return note; }

public void setNote(String n) {
    note = n; }

public String getClaimNo() {
    return claimNo; }

public void setClaimNo(String c) {
    claimNo = c; }

public Timestamp getTimestamp() {
    return created;
}
public void setTimestamp(Timestamp timestamp) {
    this.created = timestamp;
}

public String getCategory() {
    return category;
}

public void setCategory(String category) {
    this.category = category;
}

public String getSubcategory() {
    return subcategory;
}

public void setSubcategory(String subcategory) {
    this.subcategory = subcategory;
}

public boolean isUpdated() {
    return updated;
}

public void setUpdated(boolean updated) {
    this.updated = updated;
}

@PrePersist
@PreUpdate
private void fillDate() {
    setTimestamp(new Timestamp(System.currentTimeMillis()));
}

}

And on this entity that does not work I use the following to create it.

currentNotesArray = em.createNamedQuery("Note.getByClaimNo").
            setParameter("claim_no", claimNumber).getResultList();

I then look at this ArrayList with the debugger and it is Null, I have seen it at other stages as an ArrayList of size 0 as well.

Anyone have any ideas why this would be. I am stumped.

Grant

  • 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-05-20T21:27:00+00:00Added an answer on May 20, 2026 at 9:27 pm

    I figured this one out. Simple silly mistake. I had been using my development database for all data gathered with a simple database connection, Although I failed to change the persistence.xml over to the dev database. Once I did that there were no problems with displaying data.

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

Sidebar

Related Questions

I have an application that reads a CSV file with piles of data rows.
I have written an application that basically gathers up a bunch of text and
I have a C# application that scans a directory and gathers some information. I
I am building a console application that gathers some data and then sends it
I have created an application that searches a directory and loads all of the
I have a web app that gathers some data from the user and saves
I have an application that sends messages to an external web service. I build
I have an application that displays an image inside of a Windows Forms PictureBox
I have an application that uses NHibernate as its ORM and sometimes it experiences
I have an application that I would like to embed inside our companies CMS.

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.