users@glassfish.java.net

Re: JPA with database Views

From: <glassfish_at_javadesktop.org>
Date: Thu, 24 Jan 2008 08:26:47 PST

Here is my entity class:
@Entity
@Table(name = "V_USED_ROLES", schema = "***")
public class UsedRoles {
        private String roleId;
        private String roleName;
        private String entityTypeId;
        private String entityTypeName;
        
        @Id
        @Column(name = "ROLE_ID", unique = true, nullable = false, insertable = true, updatable = true, length = 4)
        public String getRoleId() {
                return roleId;
        }
        public void setRoleId(String roleId) {
                this.roleId = roleId;
        }
        
        @Column(name = "ROLE_NAME", unique = false, nullable = false, insertable = true, updatable = true, length = 128)
        public String getRoleName() {
                return roleName;
        }
        public void setRoleName(String roleName) {
                this.roleName = roleName;
        }
        @Column(name = "ENTITY_TYPE_ID", unique = true, nullable = false, insertable = true, updatable = true, length = 4)
        public String getEntityTypeId() {
                return entityTypeId;
        }
        public void setEntityTypeId(String entityTypeId) {
                this.entityTypeId = entityTypeId;
        }
        @Column(name = "ENTITY_TYPE_NAME", unique = false, nullable = false, insertable = true, updatable = true, length = 30)
        public String getEntityTypeName() {
                return entityTypeName;
        }
        public void setEntityTypeName(String entityTypeName) {
                this.entityTypeName = entityTypeName;
        }
}

Here is my query in my stateless ejb:
"select model from UsedRoles model"

It works fine.
[Message sent by forum member 'aloha0504' (aloha0504)]

http://forums.java.net/jive/thread.jspa?messageID=255626