Panache Entities! Hibernate :)

19 Replies
JavaBot
JavaBotOP3y ago
This post has been reserved for your question.
Hey @I write code for € or $! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Crain
Crain3y ago
Welp, not creating an account there.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Crain
Crain3y ago
Very cringe, but I think we can still dissect it Is there a reason you're trying to expose your repository directly as a rest API?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Crain
Crain3y ago
Looks like you're trying to expose your repository as a Rest API directly, instead of using some sort of Controller/Service layer
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Crain
Crain3y ago
Before I help you fix this, you do understand the dangers of doing that, and the safe guards you need for it to work without blowing up in your face right?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Crain
Crain3y ago
Exposing your Database without any authorization layer.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Crain
Crain3y ago
Fair, just remember proper access control. This could be done at a gateway level, which is what I'd expect. To solve this problem you need to create a Projection https://quarkus.io/guides/hibernate-orm-panache#query-projection
Simplified Hibernate ORM with Panache
Quarkus: Supersonic Subatomic Java
Crain
Crain3y ago
The projection will allow you to create a separate view of your stuff, so you can still create entities using the base stuff, and then avoid infinite recursion with projections.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Crain
Crain3y ago
I normally call them something like FlatX or ProjectionX. But whatever works, works
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
JavaBot
JavaBotOP3y ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
JavaBot
JavaBotOP3y ago
Post Closed
This post has been closed by <@315595292756017154>.

Did you find this page helpful?