Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright 2007 Daniel Spiewak
  * Licensed under the Apache License, Version 2.0 (the "License"); 
  * you may not use this file except in compliance with the License. 
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and
 * limitations under the License.

A specific extension of RawEntity providing the getID() method. This interface should be sufficient for most entity needs. Only in cases where custom primary keys are required should RawEntity be directly extended.

Entity is the superinterface for most entity interfaces. For example, the following code defines an entity which maps to the "company" table (depending on what is in use) with fields "name", "publiclyTraded" and "id" (names depending on the in use):

public class Company extends Entity {
     public String getName();
     public void setName(String name);
     public boolean isPubliclyTraded();
     public void setPubliclyTraded(boolean publiclyTraded);

Daniel Spiewak
See also:
public interface Entity extends RawEntity<Integer> {

Retrieves the value of the "id" field in the entity; that is, the primary key. As this is the primary key, no database query will correspond with this method invocation.

For the moment, primary key fields are immutable. However, this will change before the 1.0 release as there are numerous use-cases for changing the value of a row's primary key field.

The value of the primary key for the row, the "id" field.
	public int getID();
New to GrepCode? Check out our FAQ X