Create Entity Class from Remote Database (through connection) - java

I am using Netbeans 7.3.1, working on CloudBees host infrastructure (JBoss 7).
In the Services panel, I have created a connection to the remote MySQL database. I also added the persistence.xml information provided in CloudBees management page into EJB module project.
I want to create EJB Entity class but because it is remote resource, Netbeans cannot understand it at development time (no local database is present).
Is there anyway to generate a Entity Class from a Service's connection, or create datasource from that connection?

looks more like a NetBeans question. Any JavaEE application using a JNDI datasource will have the same issue

Related

How to configure Glassfish on AWS Elastic Beanstalk, Connection Pool and Realm

I developed a Java EE 7 application, that uses Glassfish as the application server and MySQL as the database.
locally every thing is working correctly
now, I want to deploy the application to the cloud using AWS.
after reading some official documentations:
I created The database in the cloud 'AWS RDS', and conneted to it from MySQL Workbench and also The application in my workspace was able to connect to it and act on it.
Now for The application deployment I used Elastic Beanstalk with Glassfish 4.1 Java 8 (the docker one).
The probleme is that I need to configure Glassfish In AWS to
Create JDBC Connection Pool
Create JDBC Resource
Create A Security Realm
so that the apllication can work correctly.
How Can I do This?
I switch to Jelastic, I can access admin page usign their cloud, and I already deployed my appication

What does multitier means in weblogic server JNDI Lookup

I was checking InitialContext object and properties that are need for JNDI lookup. One of the property which is required for InitialContext is INITIAL_CONTEXT_FACTORY for environment, for weblogic server its value is weblogic.jndi.WLInitialContextFactory.
In the documentation of weblogic.jndi.WLInitialContextFactory it is said:
weblogic.jndi.WLInitialContextFactory can also be used to create a multitier connection to another naming service through a WebLogic Server.
I did not understand the meaning of multitier connection. Can someone elaborate what exactly it means?
Two-tier connections are when the client loads the connection driver into the same JVM and that driver communicates directly with the resource.
Multitier connections are when WebLogic loads a driver into its JVM. The client communicates with WebLogic. WebLogic communicates with the resource. (There could be additional steps inbetween.)
To use a database connection as an example, this is useful because your client doesn't need to have the native libraries for the database and you can allow WebLogic to manage particulars like connection pooling, keep alive, and stale connection disposal, or load balancing and failover.
It also allows you to configure details such as the remote machine name, user name, and password in WebLogic while your code only needs to know the JNDI name.
This should be saying that WebLogic supports remote naming services for you in a way that's similar to how you might set up a JNDI name for a JDBC connection, message queue/JMS, or other remote service.

Deployed Tomcat 6 webapp can't connect to Amazon RDS Oracle instance

We are building a Java Spring-based web application that accesses an Oracle backend via Hibernate.
Here is our stack/tools:
Tomcat 6
Maven 3
Spring (mvc, web, orm) 3.2.0
Hibernate 4.1.9
Oracle 11g Release 2
Intellij IDEA.
To access the RDS from our local machines, we are port forwarding localhost:2521 to our-rds-instance-name.wercytsdzeszx.us-east-1.rds.amazonaws.com:1521
We are running embedded Tomcat using the tomcat6-maven-plugin. Our Maven configuration for testing is clean package tomcat6:run-war-only. This will deploy the WAR file to http://app.local:8080/our-app-name/ and allow us to test the site through this link.
Using Hibernate, we can connect successfully to the RDS instance when we are running the web app from our local embedded Tomcat instances.
HOWEVER - this is where it gets stupid - when we deploy the WAR file to our EC2 instance (which is part of a security group that has access to the RDS instance), the application can no longer access the database. We receive this error:
org.hibernate.exception.GenericJDBCException: Could not open connection
This is boggling my mind. We have installed SQLPlus on our EC2 instance running Tomcat and we can connect to the RDS instance, so the EC2 instance does have access to connect to the RDS instance.
Our local connection string would look something like this:
*jdbc:oracle:thin:USER_NAME/password#localhost:2521/sid*
Our EC2 (staging) instance connection string would look like this:
*jdbc:oracle:thin:USER_NAME/password#our-rds-instance-name.wercytsdzeszx.us-east-1.rds.amazonaws.com:1521/sid*
I can provide more details, but I first wanted to get the main problem out there so I don't muddy the waters with useless information.
I appreciate all feedback.
Tony
I have solved this problem.
It turns out there was an Oracle timezone error (ORA-01882: timezone region not found) that was the culprit. The Ubuntu server we are using for our EC2 AMI had a default timezone set that I guess was not recognized by Java or Oracle. I had seen that error, but ignorantly thought it could not be related to a database connectivity error.
We used the dpkg-reconfigure tzdata command to set the timezone to the correct one and restarted Tomcat. This allowed us to connect successfully to the Oracle database.
Tony

Deploy independent EJB in WebLogic 12c

I want to deploy a EJB module that i develop in Netbeans. The EJB contains web services using JAX WS library and Stateless Session Beans... The Session Bean class use a remote interface that is in another JavaApplication Project and in the same JavaApplication project has other classes used as library. The EJB use a datasource created in netbeans to connect with SQL SERVER and all work fine!... I read the documentation of weblogic 12c to deploy a independent EJB with webservices and connections to a DataBase but donĀ“t understand very well how deploy the EJB...
what steps I have to follow to deploy this EJB? how package the ejb to use a JavaApplication as library? How the EJB connect to the DataBase? web services could be used by the wsdl?

How to access database with Oracle ADF

I'm learning how to use ADF to build a webservice based desktop application.
I already have the code that sync webservice data with local derby database(for cache) from exist project.
Is there anyway to access database directly via ORM/entity or something that ADF generated?
Is creating JPA persistence unit xml files & Toplink sessions a correct way coding with ADF applications?
(Not sure I've understood you correctly)
To create database connection:
Application Navigator -> Application Resources panel
right click on Connections folder -> New connection -> Database...
Then you create Application Module, put Entity Objects there and so on

Categories