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]
|