1

I am facing a a problem using zkoss with hibernate

I have Two models one is JuvenileInfo other is SchoolMeasure

In SchoolMeasure I have created a manyToOne relationship

@Transient @ManyToOne @JoinColumn(name = "juvenile_id", nullable = false) public JuvenileInfo juvenile;

When I access

SessionFactory sessionFactory = new Configuration().configure() .buildSessionFactory();

Session session = sessionFactory.openSession(); session.beginTransaction(); List result1 = session.createQuery( "from ShoolBasedMeasure e inner join e.juvenile ") .list();

I got error juvenile is not property , So anyone can help me how I get parent record list view to show its any column

1 Answer 1

1

The error is caused because you're using @Transient annotation. @Transient annotation should be used only on not-persisted attributes, which is probably your problem, simply because Hibernate can't find the transient attributes in the database.

In this case you should do one of the following solutions:

  1. If juvenile is a persistent attribute, then you should remove the @Transient annotation of it;
  2. If juvenile is NOT a persistent attribute and you are using it only for a logic that need this attribute, then you should remove the mappings @ManyToOne and @JoinColumn;

Based on what you are describing, the first solution will probably works, let us know if it solves your problem.

Sign up to request clarification or add additional context in comments.

4 Comments

I try the the first solution removing @Transient but it not worked for me
Are your database tables properly mapped according to your entity mappings? The error you are getting is caused by incorrect mappings of your entities, please check again if they are correct.
Yes I am able to get Now Thanks
Awesome! Could you please upvote my answer and mark it as correct? This way we could also help other people with the same problem than yours. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.