[jboss-user] [EJB 3.0] - Re: EJB3 query language

thanukshad do-not-reply at jboss.com
Wed Nov 28 01:33:40 EST 2007


this is my entity bean
package com.genesiis.sdb3.master3;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
	@Table(name = "Language")
	
	@NamedQuery(name = "Language.findByAgentCode", query = "SELECT l FROM Language L WHERE L.AgentCode = :agentCode")		
	public class Language3 implements Serializable {
		@Id
			@Column(name = "LanguageCode", nullable = false)
			private String languageCode;
		
		@Column(name = "AgentCode")
			private String agentCode;
		
		@Column(name = "Description")
			private String description;
		
		@Column(name = "SortKey")
			private int sortKey;
				
		@Column(name = "LastUpdatedUser")
			private String lastUpdatedUser;
		
		public Language3() {
		}
				
		public Language3(String languageCode, String agentCode, String description, 
		int sortkey, String lastUpdatedUser) {
			this.languageCode = languageCode;
			this.agentCode = agentCode;
			this.description = description;
			this.sortKey = sortkey;
			this.lastUpdatedUser = lastUpdatedUser;
		}
		
		public void setLanguageCode(String languageCode){
			this.languageCode = languageCode;
		}
				
		public void setAgentCode(String agentCode){
			this.agentCode = agentCode;
		}
		
		public void setDescription(String description){
			this.description = description;
		}
		
		public void setSortKey(int sortKey){
			this.sortKey = sortKey;
		}
				
		public void setLastUpdatedUser(String user){
			this.lastUpdatedUser = user;
		}
		
		/***getters*************************/
		public String getLanguageCode(){
			return this.languageCode;
		}
		
		public String getAgentCode(){
			return this.agentCode;
		}
				
		public String getDescription(){
			return this.description;
		}
		
		public int getSortKey(){
			return this.sortKey;
		}
		
		public String getLastUpdatedUser(){
			return lastUpdatedUser ;
		}
				
		public int hashCode() {
			int hash = 0;
			hash += (this.languageCode != null ?
				this.languageCode.hashCode() : 0);
			return hash;
		}
		
		public boolean equals(Object object) {
			if (object == null || !this.getClass().equals
				(object.getClass())) {
				return false;
			}
			Language3 other = (Language3)object;
			if (this.languageCode != other.languageCode &
				(this.languageCode == null || !this.languageCode.
				equals(other.languageCode))) {
				return false;
			}
			return true;
		}
		
		
		
		public String toString() {
			return "" + this.languageCode;
		}
		
	}
			
And the persistemce.xml is as follow


	<persistence-unit name="Language">
		This unit manages orders and customers.
			It does not rely on any vendor-specific features and can
			therefore be deployed to any persistence provider.
		
		<jta-data-source>java:jdbc/sdbDatabase</jta-data-source>
		<jar-file>../sdb3.jar</jar-file>
		com.genesiis.sdb3.master3.Language3
	</persistence-unit>


what would be the error??

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108306#4108306

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108306



More information about the jboss-user mailing list