1
I have a file . properties to configure my project’s database. However, I cannot read the file.
Someone gives a force?
Entitymanagerproducer
@ApplicationScoped
public class EntityManagerProducer {
private EntityManagerFactory factory;
public EntityManagerProducer() throws FileNotFoundException, IOException {
Properties p = new Properties();
p.load(new FileInputStream("./conexao.properties"));
factory = Persistence.createEntityManagerFactory("AlmoxarifadoPU");
}
@Produces @RequestScoped
public EntityManager createEntityManager() {
return factory.createEntityManager();
}
public void closeEntityManager(@Disposes EntityManager manager) {
manager.close();
}
File properties
jdbc.user=root
jdbc.password=
jdbc.url=jdbc:mysql://localhost/almoxarifadome"
jdbc.driver=com.mysql.jdbc.Driver
where this located this archive connexion.properties ? in Resources? why not use the default JPA(persistence.xml) ?
– Dilnei Cunha