# Crear un proyecto EJB

Crear un proyecto EJB Maven, donde se crearan los Entity del proyecto.

![](/files/-Lc1WryoyrtNPTIREfV0)

Indicamos el nombre ejbtest

Seleccionar GlassFish como servidor y Java EE Versión

![](/files/-Lc1Wryqr93rP-D3L00U)

## Agregar la dependencia en archivo pom.xml

```
<dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>

            <dependency> 
            <groupId>com.github.avbravo</groupId> 
            <artifactId>ejbjmoordb</artifactId> 
            <version>0.2.8</version> 
        </dependency> 
           <dependency> 
            <groupId>com.github.avbravo</groupId> 
            <artifactId>avbravoutils</artifactId> 
            <version>0.13</version> 
        </dependency>


<repositories>

        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
```

## Crear el paquete Entity

## ![](/files/-Lc1Wrys9xKYXhjxWJGr)

## UML

![](/files/-Lc1WryuYO3pbEV3QvxY)

## Crear el Entity Usuario

```
@Getter
@Setter
@ToString
public class Usuario {
    @Id
     private String username;
     private String nombre;
     private String password;
     private String grupo;

    public Usuario() {
    }


}
```

## Crear Entity Paises

```
@Getter
@Setter
public class Paises{ 
    @Id
    private String idpais;
    private String pais;
    @Embedded
    private List<UserInfo> userInfo;

    public Paises(){
    }
}
```

**Crear Entity Personas**

Usaremos una referfencia a Paises

```
@Getter
@Setter
public class Personas{
   @Id 
   private String cedula;
   private String nombre;
   @Referenced(documento="Paises",facade="com.ejbtest.ejb.PaisesFacade",
               typejava="String", lazy=false)
   @Embedded
    private List<UserInfo> userInfo;
   Paises paises;

   public Personas(){
   }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://avbravo-2.gitbook.io/wizardjmoordb/chapter1/crear-un-proyecto-ejb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
