Home > Default > JPA EntityManager connection

JPA EntityManager connection

November 30Hits:0
Advertisement
Hi, I'm trying to get into the Java Persistence Api, so I came up with these questions:
I'm planning to use it in a existing db desktop application, currently using java.sql.connection object to query the mysql server.
May I share the connection between the JPA and the current logic or should I open a new one for the JPA ?..
As this is a desktop app, I would like to dinamically create the JPA connection as I do with the java.sql.connection, I dont want setup again in the persistence.xml file, is this possible without create a Datasource?..
I do appreciate your help!!..

Answers

Using Jboss 4.0.5 + SQLServer. When calling
con = (Connection) login.connectToDatasource(null);
I get
java.lang.Throwable: STACKTRACE
     at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:290)
     at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:417)
     at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
     at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
     at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:145)
     at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:185)
at my calling line

Read other 12 answers

Tags:

Related Articles

  • JPA EntityManager connectionNovember 30

    Hi, I'm trying to get into the Java Persistence Api, so I came up with these questions: I'm planning to use it in a existing db desktop application, currently using java.sql.connection object to query the mysql server. May I share the connection betw

  • JPA EntityManager shared across OSGi modulesNovember 30

    Hi, I'd like to create an OSGi module which would act as a 'JPA master' making JPA EntityManager available to other OSGi modules. The persistence.xml would be part of this module but it would do nothing more. I'd like to then access EntityManager fro

  • Toplink JPA: jdbc connection access requiredNovember 30

    I have a strong reason why direct access to the connections used by Toplink JPA is required: for each connection I need to execute - a "set role" to grant permissions, - "set lock mode" to prevent hangups, - "set isolation" t

  • JPA, EntityManager and RMINovember 30

    Hello, in my client server application, I want to get a DAO from the server to add or update a business object. My problem is that the DAO must have a property with the EntityManager so he can do his job, this EntityManager is not serializable, so RM

  • JPA - EntityManager - createQuery - InheritanceNovember 30

    I'm quite new to JPA and I need support on query syntax. I have an abstract entity: @MappedSuperclass public abstract class HACCP implements Serializable { }and more than one concrete implementations used to differentiate the DB table where data are

  • Problem accesing JPA EntityManager from JSP scripletOctober 11

    Hy, I am trying to access an EntityManager from JSP scriptlet for testing purposes and it just doesn't work. Here is the JSP scriptlet: <% EntityManager em = (EntityManager) (new InitialContext()).lookup("java:comp/env/persistence/em"); Query

  • Spring and TopLink/JPA on OC4J 10.1.3.4.0October 11

    Our configuration worked fine on OC4J 10.1.3.1 (linux) and 10.1.3.3 (windows). We have a problem with JPA (toplink essentials--not eclipselink) on OC4J 10.1.3.4.0 using Spring (2.0.7 and 2.5.6). We found that it was trying to connect to the default O

  • Progress Reporter - Failed to connect to data sourceNovember 30

    Installed Progress Reporter and successfully call up the configuration page (http://WLS_server_name:7001/pr/admin/configuration) fill out the Database URL with the URL I use in SQL Developer (jdbc:oracle:thin:@db_Server_Name:1521:primavera) Public Gr

  • Can't get EntityManager access in JSP/ServletNovember 30

    Hi all, our team has started a EJB project (EJBs + JPA configurations) we managed to access the configured JPA (EntityManager etc) within the EJB instance; however we don't know how to access the EntityManager within JSP/Servlet Our project's structu

  • Error lookup EntityManager on OC4J 10.1.3.1.0October 11

    Hi, I've just upgraded my development environment from 10.1.3.0.0 to 10.1.3.1.0. I'm heaving trouble in this version when I try to lookup a JPA EntityManager using JNDI. I got following code fragment from the howto guides from 10.1.3.0, and they work

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.653 s.