Intellij Jpa console db schema
Asked Answered
B

3

9

When I want make query in Intellij JPA console I get error that relation "topic" does not exist. Jpql query select t from Topic t. I'm using spring boot, I added jpa to module, persistence toolbar works well, but jpa console doesn't. My thougs that JPA Console not find in right db schema, but datasource selected corect.

JPA console print: [2019-07-19 12:49:59] [42P01] ERROR: relation "topic" does not exist [2019-07-19 12:49:59] Position: 60

Brogue answered 19/7, 2019 at 10:53 Comment(9)
Apparently there is no table named topic in your database. You need to create one firstWear
But in database also in database toolbar is visible :/Brogue
Maybe you quoted it when you created it? "Topic" a different table name than topicWear
tables made automaticaly by ormBrogue
Then your obfuscation layer should be able to generate the correct SQL queries.Wear
Can be problem that I don't have set naming strategy on entity manager factory in persistence toolbar? I don't have idea what I should chose..Brogue
Let us continue this discussion in chat.Brogue
Add more details: what is the database, how you define mappings? Can you run same query from code? Check e.g. #30627489Dryfoos
Yes I'm able run same query from code. But I don't have set naming strategy... screen: linkBrogue
B
5

I found my mistake in connection to database. I had in field Database value postgres, I replace by chatapp - it is correct schema, and now it works well

Database settings

Brogue answered 22/7, 2019 at 9:17 Comment(0)
K
7

Did you do all those steps?:

enter image description here

(The IDEA version is 2019.1)

Kacey answered 20/7, 2019 at 15:27 Comment(3)
very nice animation, I have all set as you show, but if i try hibernate console it ends by exception: [2019-07-20 23:11:30] org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 0 and column 0 in FILE C:\Users\ondra\.IntelliJIdea2019.1\system\compiler\agent-chat.87f53839\.generated\Jpa_Console\agent-chat.main-hibernate-1563657080743.cfg.xml. Message: null [2019-07-20 23:11:30] javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.Brogue
@AndrewSneck Maybe it's related to JAXB-API and Java version issue somehow?Kacey
I add this dependecies: implementation "javax.xml.bind:jaxb-api:2.2.11" implementation "com.sun.xml.bind:jaxb-core:2.2.11" implementation "com.sun.xml.bind:jaxb-impl:2.2.11" implementation "javax.activation:activation:1.1.1" and hibernate console now show same error as jpa console specifically: ERROR: relation "topic" does not existBrogue
B
5

I found my mistake in connection to database. I had in field Database value postgres, I replace by chatapp - it is correct schema, and now it works well

Database settings

Brogue answered 22/7, 2019 at 9:17 Comment(0)
B
0

first, New Database and specify schema with jdbc url, such like this:

jdbc:postgresql://www.test.xyz:27017/spring_boot?currentSchema=test

New Database and specify schema and then, open Persistence window and right-click Assign Data Sources... and assign data source before you register right-click Assign Data Sources IDEA Version: IntelliJ IDEA 2024.2 (Ultimate Edition)

Brownley answered 8/8, 2024 at 15:5 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.