Code Monkey home page Code Monkey logo

Comments (7)

yrodiere avatar yrodiere commented on June 13, 2024

Understanding your problem will be easier with the code. Please point us to your branch, or send a PR, so we can have a look?

from hibernate-test-case-templates.

geoffreywiseman avatar geoffreywiseman commented on June 13, 2024

Sure, it was this fork:
https://github.com/geoffreywiseman/hibernate-test-case-templates

from hibernate-test-case-templates.

yrodiere avatar yrodiere commented on June 13, 2024

Your problem was that you defined the entities in your main code, but the persistence.xml in your tests.

If I remember correctly, Hibernate ORM will only look for entities in the same JAR as the persistence.xml when performing classpath scanning.

So moving the persistence.xml to the main code fixes the problem: geoffreywiseman#1
Alternatively, you can move the entities to the test code, which is generally what we do for test cases.

I will close this issue for now, feel free to reopen if my answer didn't help.

from hibernate-test-case-templates.

geoffreywiseman avatar geoffreywiseman commented on June 13, 2024

Ok, I guess that makes some sense. Normally I'd expect tests to include and use the main classpath as well as their own classpath, but I don't know that much about how the Hibernate JPA scanning is written. It probably makes sense to compartmentalize somewhat in case you have multiple JPA-enabled JARs in a single classpath. Anyway: might not be a terrible idea to suggest where you reference automation detection that the model will be automatically detected if it's placed in the src/test package hierarchy, since that's where persistence.xml is found.

But thanks, I'll be better able to make a test case next time. ;)

from hibernate-test-case-templates.

DonaldMaparura avatar DonaldMaparura commented on June 13, 2024

what if im using application.properties file how do l solve this error
Panache.getEntityManager().merge(products); is not picking my entity

from hibernate-test-case-templates.

yrodiere avatar yrodiere commented on June 13, 2024

@DonaldMaparura You seem to be using Quarkus. You'll have better answers if you ask the Quarkus community there: https://quarkus.io/community/ . When you ask them, provide the full stack trace, otherwise they are unlikely to understand what is going on.

from hibernate-test-case-templates.

DonaldMaparura avatar DonaldMaparura commented on June 13, 2024

from hibernate-test-case-templates.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.