hibernate / hibernate-demos Goto Github PK
View Code? Open in Web Editor NEWRepository for demos of various Hibernate projects
License: Apache License 2.0
Repository for demos of various Hibernate projects
License: Apache License 2.0
Could anyone explain what is "Hibernate ORM's features file, obtained from a binary distro or JBoss Nexus". I didn't work with Nexus, I tried to enter its repo but I don't understand what is a "binary distro". If anyone could provide a link it would be great.
I've following query :
try (Session session = sessionFactory.openSession()) {
var clients = session.createNativeQuery("select c.fullname, c.city from client c where c.id=:id")
.addEntity("c", Client.class)
.setParameter("id", id);
and there's filed id in entity and in a database too but getting
Caused by: java.sql.SQLException: Column 'id' not found.
Here's entity class:
public class Client implements java.io.Serializable {
private Integer id;
private Product product;
private String fullname;
private String business;
private String address;
I'm using MySQL 8.0.21 Hibernate 5.4.14 JDK 11.0.8+10
I won't use JPA Criteria cause I'm checking performance using NativeQuery.
Hibernate components: How can I solve the memory overflow problem caused by Statement ”in...“?
I used karaf 4.0.5. I completed all steps that are provided in instructions. This is my bundle list:
karaf@root()> bundle:list
START LEVEL 100 , List Threshold: 50
52 | Active | 80 | 3.18.1.GA | Javassist
53 | Active | 80 | 1.1.1 | geronimo-jta_1.1_spec
54 | Active | 80 | 2.7.7.5 | Apache ServiceMix :: Bundles :: antlr
55 | Active | 80 | 1.6.1.5 | Apache ServiceMix :: Bundles :: dom4j
56 | Active | 80 | 5.0.0.Final | hibernate-commons-annotations
57 | Active | 80 | 5.0.0.Final | hibernate-core
58 | Active | 80 | 5.0.0.Final | hibernate-entitymanager
59 | Active | 80 | 1.0.0.Final | hibernate-jpa-2.1-api
60 | Active | 80 | 5.0.0.Final | hibernate-osgi
61 | Active | 80 | 1.2.2.Final | Java Annotation Indexer
62 | Active | 80 | 3.3.0.Final | JBoss Logging 3
63 | Active | 80 | 1.3.170 | H2 Database Engine
64 | Active | 80 | 1.0.0 | unmanaged-jpa
This is the result:
karaf@root()> dp:addJPA Nick
Error executing command: Unable to locate persistence units
This is from log:
executing command
javax.persistence.PersistenceException: Unable to locate persistence units
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:84)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.osgi.OsgiPersistenceProvider.createEntityManagerFactory(OsgiPersistenceProvider.java:78)[60:org.hibernate.osgi:5.0.0.Final]
at org.hibernate.osgitest.HibernateUtil.getEntityManagerFactory(HibernateUtil.java:53)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
at org.hibernate.osgitest.HibernateUtil.getEntityManager(HibernateUtil.java:41)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
at org.hibernate.osgitest.DataPointServiceImpl.add(DataPointServiceImpl.java:37)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
at org.hibernate.osgitest.command.AddCommand.execute(AddCommand.java:40)[64:org.hibernate.osgi.unmanaged-jpa:1.0.0]
at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:34)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.karaf.shell.compat.CommandTracker$1.execute(CommandTracker.java:112)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)[44:org.apache.karaf.shell.core:4.0.5]
at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:270)[44:org.apache.karaf.shell.core:4.0.5]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_45-internal]
Caused by: org.hibernate.internal.util.xml.XsdException: Unable to locate schema [org/hibernate/jpa/persistence_1_0.xsd] via classpath
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.resolveLocalSchema(PersistenceXmlParser.java:408)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.v1Schema(PersistenceXmlParser.java:398)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.validate(PersistenceXmlParser.java:333)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.loadUrl(PersistenceXmlParser.java:290)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.parsePersistenceXml(PersistenceXmlParser.java:94)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.doResolve(PersistenceXmlParser.java:84)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.jpa.boot.internal.PersistenceXmlParser.locatePersistenceUnits(PersistenceXmlParser.java:66)[58:org.hibernate.entitymanager:5.0.0.Final]
at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilderOrNull(HibernatePersistenceProvider.java:80)[58:org.hibernate.entitymanager:5.0.0.Final]
... 17 more
What the heck is vividsolutions? Are you sure there is no other way to declare a point? (Project.java imports)
52 | Active | 80 | 0.0.0 | features.xml
53 | GracePeriod | 80 | 1.0.0 | managed-jpa
54 | Active | 80 | 3.18.1.GA | Javassist
55 | Active | 80 | 1.1.1 | geronimo-jta_1.1_spec
56 | Active | 80 | 2.7.7.5 | Apache ServiceMix :: Bundles :: antlr
57 | Active | 80 | 1.6.1.5 | Apache ServiceMix :: Bundles :: dom4j
58 | Active | 80 | 5.0.0.Final | hibernate-commons-annotations
59 | Active | 80 | 5.0.0.Final | hibernate-core
60 | Active | 80 | 5.0.0.Final | hibernate-entitymanager
61 | Active | 80 | 1.0.0.Final | hibernate-jpa-2.1-api
62 | Active | 80 | 5.0.0.Final | hibernate-osgi
63 | Active | 80 | 1.2.2.Final | Java Annotation Indexer
64 | Active | 80 | 3.3.0.Final | JBoss Logging 3
65 | Active | 80 | 3.0.0 | Expression Language 3.0 API
66 | Active | 80 | 1.2.0 | CDI APIs
67 | Active | 80 | 1.2 | javax.interceptor API
68 | Active | 80 | 1.2 | javax.transaction API
69 | Active | 80 | 1.1.1 | Apache Aries Transaction Blueprint
70 | Active | 80 | 2.1.0 | Apache Aries Transaction Blueprint
71 | Active | 80 | 1.3.1 | Apache Aries Transaction Manager
72 | Active | 80 | 1.0.2 | Apache Felix Coordinator Service
73 | Active | 80 | 1.0.0.2 | Apache ServiceMix :: Bundles :: javax.inject
74 | Active | 80 | 2.3.0 | Apache Aries JPA Container API
75 | Active | 80 | 2.3.0 | Apache Aries JPA blueprint
76 | Active | 80 | 2.3.0 | Apache Aries JPA container
77 | Active | 80 | 2.3.0 | Apache Aries JPA support
78 | Active | 80 | 1.1 | Apache Geronimo JSR-317 JPA 2.0 Spec API
79 | Active | 80 | 1.0.0.201505202023 | org.osgi:org.osgi.service.jdbc
80 | Active | 80 | 1.0.0.201505202024 | org.osgi:org.osgi.service.jpa
88 | Active | 80 | 0.0.0 | datasource-h2.xml
89 | Active | 80 | 1.3.170 | H2 Database Engine
Status: GracePeriod
Blueprint
17-5-9 下午7:20
Missing dependencies:
(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://aries.apache.org/xmlns/jpa/v1.0.0))
how to do it???
Actually it's not an issue but a question. Nevertheless, it seems weird and I consider it to be an issue.
Why do you list all entity classes when using JTA transaction type? Why entity manager does not see entities by annotations? Are the any other options rather than listing all entities?
Hello All,
I've modified org.hibernate.demos.jpacditesting.CdiJpaTest a litte bit and I get an ARJUNA017003 Exception:
checking transaction and found that this connection is already associated with a different transaction! Obtain a new connection for this transaction.
Works this as expected or is this a bug? How can I test my services which are annotated with REQUIRES_NEW?
Kind Regards
Tom
As I'm trying to setup our projects to make JPA tests possible without using Arquillian (which is a pain due long deployment times on WAS 9) I found @gunnarmorling demo jpa-cdi-testing
project which seems to do exactly this.
So I just cloned it, importet it into IntelliJ and executed the tests. But both fail with this error message:
2020-03-21 20:34:50 INFO Version:148 - WELD-000900: 3.0.5 (Final)
org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Built-in Bean [javax.transaction.UserTransaction] with qualifiers [@Default] with class interface javax.transaction.UserTransaction using classloader jdk.internal.loader.ClassLoaders$AppClassLoader@2626b418
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:370)
at org.jboss.weld.bean.proxy.ProxyFactory.run(ProxyFactory.java:324)
at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:316)
at org.jboss.weld.bean.builtin.ee.AbstractEEBean.<init>(AbstractEEBean.java:36)
at org.jboss.weld.module.jta.UserTransactionBean.<init>(UserTransactionBean.java:52)
at org.jboss.weld.module.jta.WeldTransactionsModule.preBeanRegistration(WeldTransactionsModule.java:46)
at org.jboss.weld.module.WeldModules.preBeanRegistration(WeldModules.java:158)
at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:224)
at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:432)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:86)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:800)
at org.jboss.weld.junit.AbstractWeldInitiator.initWeldContainer(AbstractWeldInitiator.java:495)
at org.jboss.weld.junit4.WeldInitiator.access$300(WeldInitiator.java:90)
at org.jboss.weld.junit4.WeldInitiator$1.evaluate(WeldInitiator.java:226)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.Error: java.lang.NoSuchFieldException: override
at org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:394)
at org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:385)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:551)
at org.jboss.classfilewriter.ClassFile.<clinit>(ClassFile.java:385)
at org.jboss.weld.bean.proxy.ProxyFactory.newClassFile(ProxyFactory.java:476)
at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:436)
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:362)
... 28 more
Caused by: java.lang.NoSuchFieldException: override
at java.base/java.lang.Class.getDeclaredField(Class.java:2417)
at org.jboss.classfilewriter.ClassFile$1.run(ClassFile.java:392)
... 34 more
Process finished with exit code -1
Would really see this demo working again so I can try to adopt things of it for our scenario.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.