Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (C) 2012 Clarion Media, LLC
  * 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,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package com.clarionmedia.infinitum.orm.annotation;

This annotation indicates if a Field is a primary key. If the annotation is missing from the class hierarchy, Infinitum will look for a Field called mId or id to use as the primary key. If such a Field is found, autoincrement will be enabled for it by default if it is of type int or long. If the primary key is assigned to a Field which is not an int or long and autoincrement is enabled, a com.clarionmedia.infinitum.orm.exception.ModelConfigurationException will be thrown at runtime. Any Field marked as a primary key will inherently be marked as persistent, regardless of any Persistence annotation that might be associated with it.

The Infinitum ORM currently only supports a single primary key per model, meaning composite keys will throw a ModelConfigurationException.

Tyler Treat
1.0 02/13/12
public @interface PrimaryKey {

Indicates if the primary key is set to autoincrement. This is only valid for primary keys which are of type int or long.

true if autoincrement is enabled, false if not
	boolean autoincrement() default true;
New to GrepCode? Check out our FAQ X