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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:43:00+00:00 2026-05-16T23:43:00+00:00

I started creating JPA/hibernate mappings for a legacy database based on Oracle. At one

  • 0

I started creating JPA/hibernate mappings for a legacy database based on Oracle. At one (early…) point I have a many-to-many relation between to tables (FOO, BAR, join table with extra fields: FOO_BAR). So I defined three entities, created an embeddable Id class for the join table, strictly following some examples from a good (?!) book.

I can select a Foo but whenever I try to read the related Bars from the result set, I get wither an “SQLException: No data found” or a “SQLException: General error (S1000)”. I can switch between the two by just changing some java types of the entity beans…

The log contains the following line n case of the “No data found” error:

INFO org.hibernate.type.LongType - could not read column value from result set: Foo1_2_; No data found

The columns FOO_ID and BAR_ID are defined as NUMBER(22). I tried Long types first, this resulted in “No data found”, Double led to “General error”. Then I read somewhere that the standard mapping for NUMBER is BigDecimal (-> “General Error”), I tried BigInteger instead (-> “No data found”).

I’m lost.

When I take the sql statement from the logs and use it with “native” jdbc, … it works fine.

PreparedStatement prep = con.prepareStatement(sqlQueryFromHibernateLogs);
prep.setBigDecimal(1, new  BigDecimal(1));
ResultSet rs = prep.executeeQuery();  // result set has the correct values...

Any help, suggestions, pointers to helpful resources are highly appreciated. Oh, one final thing to mention: I’m ‘forced’ to use the JdbcOdbc bridge. It’s really a legacy system…


My select statement goes like this:

List<Foo> foos = em.createQuery("select f from Foo f order by f.name").getResultList();

Edit

Versions – I’m bound to the hibernate libraries that are shipped with the play framework (1.0.3.2). The hibernate3.jar has no useful version information (nothing in Manifest, Version#getVersionString() says [WORKING]), the other hibernatexxx jars report as 3.1.0.GA (validator) or 3.4.0.GA (entitymanager).


Edit 2

I’ve reduced the classes to the absolute minimum with the errors still present. This is what I did:

Foo.java

@Entitiy @Table(name="FOO")
public class Foo {
  @Id @Column(name="FOO_ID")
  private BigInteger fooId;

  Foo(){}

  @OneToMany(mappedBy="foo")
  private Set<FooBar> fooBars = new HashSet<FooBar>();
}

Bar.java

@Entitiy @Table(name="BAR")
public class Bar {
  @Id @Column(name="BAR_ID")
  private BigInteger fooId;

  Bar(){}

  @OneToMany(mappedBy="bar")
  private Set<FooBar> fooBars = new HashSet<FooBar>();
}

FooBar.java

@Entitiy @Table(name="FOOBAR")
public class FooBar {

  @Embeddable
  public static class Id implements Serializable {
    @Column(name="FOO_ID")
    private BigInteger fooId;
    @Column(name="BAR_ID")
    private BigInteger barId;

    Id() {}

    // implementations of hashcode and equals

  }

  @Embedded
  private Id id = new Id();

  @ManytoOne @JoinColumn(name = "FOO_ID", insertable=false, updatable=false)
  private Foo foo;

  @ManytoOne @JoinColumn(name = "BAR_ID", insertable=false, updatable=false)
  private Bar bar;

  FooBar(){}
}

FOO_ID and BAR_ID are defined as NUMBER(22) on the the Oracle database. The above example leads to the “No data found” error, replacing BigInteger with Long results in the “General Error”. And sending the very same SQL expression over the bridge gives a correct result set…

  • 1 1 Answer
  • 1 View
  • 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-16T23:43:00+00:00Added an answer on May 16, 2026 at 11:43 pm

    Found the solution or – at least – found out, that the approach can’t work with the given tools (hibernate, JdbcOdbc bridge):

    Some more googeling finally sent me to this (german) page, where someone had a similiar problem: a No data found SQLException while working with the bridge. Someone else answered, that the code is correct but it is a problem with the JdbcOdbc bridge which does not support reading a result set more than once. I can’t clarify, if I have the same problem here, but I’m pretty sure that it is this or a similiar case and the problem is related to using the bridge with hibernate/JPA.

    For my very special case: I solved the problem by ignoring it after … finally finding out that I can use the oracle oci driver. (sigh)

    Thanks to everyone who tried to follow my posting and thought about a solution!

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

Sidebar

Related Questions

I just started creating my data-access layer using LinqToSql. Everybody is talking about the
I am just getting started creating an AJAX application using server side push. I
I was wondering if anyone can help me get started with creating a room
I just started thinking about creating/customizing a web crawler today, and know very little
Ever since I started using .NET, I've just been creating Helper classes or Partial
I started using subversion for one of my projects and it would be absolutely
I started trying to play with Mono, mostly for fun at the moment. I
I started an application in Google App Engine right when it came out, to
I started a Rails project recently and decided to use RESTful controllers. I created
I started programming C# applications when the 1.0 framework was first released. I worked

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.