-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: JPA/Jibernate X Jasper (pass connection) best practice?
PostPosted: Wed Feb 04, 2009 8:47 am 
Newbie

Joined: Tue Jan 13, 2009 11:04 am
Posts: 13
Hello,

I'm using JPA / Hibernate and read some examples where the Internet is the connection issue par
through the report as I am using JDBC JPA would like to know if there is another way to get
get the connection because the connection like this:

[code]
EntityManagerFactory emf = Persistence.createEntityManagerFactory ( "JPA9");
EntityManager in emf.createEntityManager = ();
[/ code]


About do JPA with how to use Jasper with do?

If anyone can help me?

thanks


[code]
- example in internet ?????????? getting through the Driver and happening via Connection

public class RelatorioBibliotecaPessoal (
iexão to the database, redo the Connection object * /
/ * Enhances contornan
private static Connection getConnection () throws
ClassNotFoundException, SQLException
(
String driver = "org.firebirdsql.jdbc.FBDriver";
String url = "jdbc: firebirdsql: localhost/3050: c: / db / Acervo.FDB";
String user = "sysdba";
String password = "masterkey";
Class.forName (driver);
Connection con = DriverManager.getConnection (url, user, password);
return con;
)
/ * Generates reports and displays it * /
public void geraRelatorio () throws JRException, Exception
(
Connection con = getConnection ();
Statement stm = con.createStatement ();
String query = "select * from book";
ResultSet rs = stm.executeQuery (query);
/ * Implementation of the DataSource interface JRDataSource for ResultSet * /
JRResultSetDataSource jrRS = new JRResultSetDataSource (rs);
[/ code]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.