En este artículo crearemos un modelo de persistencia para nuestra pequeña aplicación de gestión de empleados. Basado en un anterior post donde creamos una aplicación básica de JDeveloper.

Sobre el proyecto en el menú contextual, New > EJB > Entities From Tables. Vamos a utilizar la tecnología EJB 3.0, anotando los beans de entidad como JPA 2.0:

Creating persistence model

Seleccionamos las tablas Departaments y Employees.

Como vimos en un artículo anterior, se puede obtener el diagrama de una base de datos ya hecha. Yo me lo he creado en el paquete lebrijo.diagrams:

Entity-RelationShip diagram

Podemos crear un New > EJB Diagram, y arrastrando las entidades anteriormente creada, tendremos el dibujo entero:

EJB diagram

En los dos beans refactorizaré el atributo employees por manager, ya que define más claramente la relación.

Refactoring manage relation

Esto se actualiza automáticamente en el diagrama de EJB (en teoria, en realidad hay que volver a arrastrar las entidades).

Como último ejercicio, podemos crear la consulta de encontrar por nombre, ampliando la anotación de consultas de la entidad Employees:

@Entity
@NamedQueries({
@NamedQuery(name = "Employees.findAll", query = "select o from Employees o")
,
@NamedQuery(name = "Employees.findByName", query = "select o from Employees o where o.firstName like :p_name")
})

In this post we will create a persistence model for our little employee management application. Based on an earlier post where we created a basic JDeveloper Web application.

Over the project with contextual menu, New > EJB > Entities From Tables. We will use the EJB 3.0 technology, annotating entity beans as JPA 2.0:

Creating persistence model

Select Departaments and Employees tables.

As seen in an earlier post, we can obtain the ER diagram from a made data base. I created it in the package lebrijo.diagrams:

Entity-RelationShip diagram

We can create a New > EJB Diagram, and drag-drop the created entities, we have the whole draw:

EJB diagram

I refactored the employees attribute by manager, because it defines the relationship better.

Refactoring manage relation

This is refreshed automatically to the EJB diagram (theory, in practice I have to drag the entities again).

As last exercise, we can create the ‘find by name’ query, in the query annotation at Employees entity:

@Entity
@NamedQueries({
@NamedQuery(name = "Employees.findAll", query = "select o from Employees o")
,
@NamedQuery(name = "Employees.findByName", query = "select o from Employees o where o.firstName like :p_name")
})

In a previous article we saw how to secure a Web Service with basic authentication (this could be used for every page in our application). We did it creating users with Weblogic Default Authenticator.

Today we will create an SQLAuthenticator in Weblogic, then the server will take users and groups from the data base.

Continue reading

En un artículo anterior vimos como asegurar un Web Service con autenticación básica (esto podría servir para cualquier página en nuestra aplicación). Esto lo hacíamos creando usuarios en el DefaultAuthenticator de Weblogic (user).

Hoy vamos a crear un SQLAuthenticator en Weblogic, de forma que tome esos usuarios y grupos de la base de datos.

Continue reading

Seems obvious that the best tool to develop Weblogic/OracleDB is JDeveloper. But for me, until now, it was not so obvious, because Eclipse is my favorite IDE, it is the standard for Java development (Jboss, Spring, Android,…).

If your architecture is Oracle/Weblogic, have no fear to change, and your obsesion is to increase your productivity, then, your tool is JDeveloper. I am gonna write some posts trying to demonstrate this point. But if you want an advancement, you can see this video, you will see howcan be really ssimple make RIA applications over complex enterprise environments.

Continue reading

Parece una obviedad que la mejor herramienta para desarrollar sobre Weblogic/OracleDB es JDeveloper. Pero para mi, hasta ahora, no era tan obvio, ya que Eclipse es mi IDE preferido, ya que es el estándar para el desarrollo JAVA (Jboss, Spring, Android,…).

Si tu arquitectura es Oracle/Weblogic, no tienes miedo al cambio y tu obsesión es incrementar tu productividad, tu herramienta es JDeveloper. Voy a hacer una serie de artículos tratando de demostrar este punto. Pero si quieres ir abriendo boca te recomiendo que veas este video, veras como puede ser realmente sencillo hacer aplicaciones RIA en entornos empresariales muy complejos.

Continue reading

I consider JDeveloper as a great data base design tool for some reasons:

  • It can navigates through the Oracle databases
  • It has a very good ER editor.
  • It can change the data base schema when you modify the diagram

We can download from Oracle’s web the last JDeveloper version for our operating system. Installing is very easy, you just must have installed the JDK.

Continue reading

Considero JDeveloper como una buena herramienta para el diseño de bases de datos por algunas razones:

  • Es capaz de navegar muy bien las bases de datos Oracle.
  • Tiene un editor de esquema ER muy bueno.
  • Es capaz de modificar la base de datos cuando estás modificando el esquema.

De la misma web de Oracle podemos descargar la última versión de JDeveloper para nuestro sistema operativo. Instalarlo no implica mucha dificultad, basta con tener la JDK de Java.

Continue reading

Oracle XE es la implementación ligera de la Base de Datos versión 10g para desarrolladores y DBAs que quieran hacer pruebas en local.

Se instala descargando un ejecutable de la web de Oracle. Yo he instalado la versión Windows, virtualizando Windows XP sobre VirtualBox (>>) en mi Ubuntu.

Para administrar la Base de Datos tenemos una aplicación web en http://192.168.0.7:8080/apex/:

OracleXE administration web application

Para que os hagáis una idea de los requisitos de hardware, en la instalación básica en mi sistema, la base de datos ocupa 605 MB de RAM y 880 MB de disco duro. Se ve en la figura anterior.

Ahora crearemos la base de datos que va a alojar los datso de nuestra aplicación. Sobre la misma aplicación web vamos a Administration > Database Users > Create User, y creamos el usuario school con la misma passsword, seleccionando todos los privilegios del sistema:

Creating DB Schema

Con esto hemos creado el esquema school con un usuario que tiene todos los privilegios para desarrollar sobre la base de datos.

Antes de hacer una conexión remota debemos activar la opción Administration>Manage HTTP Access > Available from local server and remote clients, en la aplicación web de administración.

Una vez hecho esto podemos conectarnos desde cualquier aplicación: Eclipse, JDeveloper, PL/SQL Developer, SQLDeveloper,… En la siguiente figura muestro como conectarse desde eclipse ya que es nuestro IDE de cabecera, y además de un pantallazo muestra todos la configuración necesaria para la conexión:

Eclipse DB connection

Oracle XE is the 10g version light Data Base implementation for developers and DBAs who wants to make local tests.

It installs downloading the executable file from the Oracle’s web. I had installed the Windows version, virtualizing my Windows XP over VirtualBox (>>) on my Ubuntu.

For administering the Data Base we have a web application at http://192.168.0.7:8080/apex/:

OracleXE administration web application

You can take an idea about the hardware requirements, in my basic installation, the data base fits 605 MB RAM and 880 MB of hard disc. You can see it in the last figure.

Now we will create a data base to host the data of our application. In the web administration application click on Administration > Database Users > Create User, and we create the user school with the same password, checking all the system privileges for it:

Creating DB Schema

Then we have create the school schema, with a user with all the privileges to develop in the data base.

Before access from a remote connection we must activate the option Administration>Manage HTTP Access > Available from local server and remote clients, in the web console.

After that we can connect from any application: Eclipse, JDeveloper, PL/SQL Developer, SQLDeveloper,… In the following screenshot I show how to connect from eclipse even it is our favorite IDE, and with a single screenshot we can see the needed configuration for the connection:

Eclipse DB connection

OEPE (Oracle Enterprise Pack for Eclipse), es una distribución de Eclipse afinada por Oracle para conectarse a sus bases de datos y desarrollar con sus tecnologías.

  • Trae ya configurado el plugin para que la perspectiva de Administración de la BBDD sea capaz de ver todos los tipos de objetos (paqetes, vistas, sinónimos,…).
  • Predescargado Weblogic, para instalarlo de un clic. Y con facilidades para desarrollar planes de despliegue sobre el.
  • Sus librerías de JSF, y los conectores SCA con Spring.

Si desarrollas Java sobre Eclipse, con los productos de Oracle detrás (SGBD y WebLogic), está bien por lo menos conocer que existe esta distro de Eclipse.

OEPE (Oracle Enterprise Pack for Eclipse), is a Eclipse distro built by and for Oracle products. In order to connect to its Data Bases and to develop with their technologies.

  • It comes with the Data Base Management Perspective, it can recreate all objects (packages, views, synonims,…).
  • Weblogic preloaded, to install by clics. And facilitates the develop of deployment plans over it.
  • JSF libraries (myfaces), and SCA Spring connectors with the apps server.

If you develop Java over Eclipse, with Oracle products backed (DBMS and WebLogic), you must know this Eclipse distro.