patriot7
patriot7

Reputation: 703

Entity is not deployed

I'm learning EJB now. When I deploy my project to glassfish server. One of my entity beans wasn't deployed. But the other 2 work properly. Here's the entity bean's code:

package com.supinfo.javapetstore.model;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "Items")
public class Item implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String reference;

    public Item() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getReference() {
        return reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    @Override
    public String toString() {
        return "Id: " + id + " / reference: " + reference;
    }
}

No error or warning appers when deploying.

Thanks a lot.

Upvotes: 0

Views: 238

Answers (1)

James
James

Reputation: 18379

Try enabling logging,

Assuming your using EclipseLink in Glassfish, add the property to your persistence.xml

<property name="eclipselink.logging.level" value="FINEST"/>

http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging

In general tables are not created by default, to enable table creation use the property,

<property name="eclipselink.ddl-generation" value="create-tables"/>

Upvotes: 2

Related Questions