Java Doc for SecondaryKey.java in  » JMX » je » com » sleepycat » persist » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » JMX » je » com.sleepycat.persist.model 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.sleepycat.persist.model.SecondaryKey

SecondaryKey
public @interface SecondaryKey(Code)


Field Summary
 Stringname
     Specifies the name of the key in order to use a name that is different than the field name.

This is convenient when prefixes or suffices are used on field names. For example:

 class Person {
 String m_parentSsn;
 }

It can also be used to uniquely name a key when multiple secondary keys for a single entity class have the same field name.

 DeleteActiononRelatedEntityDelete
     Specifies the action to take when a related entity is deleted having a primary key value that exists as a secondary key value for this entity.

Note: This property only applies when SecondaryKey.relatedEntity is specified to define the related entity.

The default action, DeleteAction.ABORT ABORT , means that a DatabaseException is thrown in order to abort the current transaction.

If DeleteAction.CASCADE CASCADE is specified, then this entity will be deleted also.

 Relationshiprelate
     Defines the relationship between instances of the entity class and the secondary keys.

The table below summarizes how to create all four variations of relationships.

Relationship Field type Key type Example
Relationship.ONE_TO_ONE Singular Unique A person record with a unique social security number key.
Relationship.MANY_TO_ONE Singular Duplicates A person record with a non-unique employer key.
Relationship.ONE_TO_MANY Array/Collection Unique A person record with multiple unique email address keys.
Relationship.MANY_TO_MANY Array/Collection Duplicates A person record with multiple non-unique organization keys.

For a many-to-x relationship, the secondary index will have non-unique keys; in other words, duplicates will be allowed. Conversely, for one-to-x relationship, the secondary index will have unique keys.

For a x-to-one relationship, the secondary key field is singular; in other words, it may not be an array or collection type. Conversely, for a x-to-many relationship, the secondary key field must be an array or collection type.

 ClassrelatedEntity
     Specifies the entity to which this entity is related, for establishing foreign key constraints.



Field Detail
name
String name(Code)
Specifies the name of the key in order to use a name that is different than the field name.

This is convenient when prefixes or suffices are used on field names. For example:

 class Person {
 String m_parentSsn;
 }

It can also be used to uniquely name a key when multiple secondary keys for a single entity class have the same field name. For example, an entity class and its subclass may both have a field named 'date', and both fields are used as secondary keys. The name property can be specified for one or both fields to give each key a unique name.




onRelatedEntityDelete
DeleteAction onRelatedEntityDelete(Code)
Specifies the action to take when a related entity is deleted having a primary key value that exists as a secondary key value for this entity.

Note: This property only applies when SecondaryKey.relatedEntity is specified to define the related entity.

The default action, DeleteAction.ABORT ABORT , means that a DatabaseException is thrown in order to abort the current transaction.

If DeleteAction.CASCADE CASCADE is specified, then this entity will be deleted also. This in turn could trigger further deletions, causing a cascading effect.

If DeleteAction.NULLIFY NULLIFY is specified, then the secondary key in this entity is set to null and this entity is updated. If the key field type is singular, the field value is set to null; therefore, to specify NULLIFY for a singular key field type, a primitive wrapper type must be used instead of a primitive type. If the key field type is an array or collection type, the key is deleted from the array (the array is resized) or from the collection (using java.util.Collection.remove Collection.remove ).




relate
Relationship relate(Code)
Defines the relationship between instances of the entity class and the secondary keys.

The table below summarizes how to create all four variations of relationships.

Relationship Field type Key type Example
Relationship.ONE_TO_ONE Singular Unique A person record with a unique social security number key.
Relationship.MANY_TO_ONE Singular Duplicates A person record with a non-unique employer key.
Relationship.ONE_TO_MANY Array/Collection Unique A person record with multiple unique email address keys.
Relationship.MANY_TO_MANY Array/Collection Duplicates A person record with multiple non-unique organization keys.

For a many-to-x relationship, the secondary index will have non-unique keys; in other words, duplicates will be allowed. Conversely, for one-to-x relationship, the secondary index will have unique keys.

For a x-to-one relationship, the secondary key field is singular; in other words, it may not be an array or collection type. Conversely, for a x-to-many relationship, the secondary key field must be an array or collection type. A collection type is any implementation of java.util.Collection .




relatedEntity
Class relatedEntity(Code)
Specifies the entity to which this entity is related, for establishing foreign key constraints. Values of this secondary key will be constrained to the set of primary key values for the given entity class.

The given class must be an entity class. This class is called the related entity or foreign entity.

When a related entity class is specified, a check (foreign key constraint) is made every time a new secondary key value is stored for this entity, and every time a related entity is deleted.

Whenever a new secondary key value is stored for this entity, it is checked to ensure it exists as a primary key value of the related entity. If it does not, a DatabaseException will be thrown by the PrimaryIndex put method.

Whenever a related entity is deleted and its primary key value exists as a secondary key value for this entity, the action is taken that is specified using the SecondaryKey.onRelatedEntityDelete property.

Together, these two checks guarantee that a secondary key value for this entity will always exist as a primary key value for the related entity. Note, however, that a transactional store must be configured to guarantee this to be true in the face of a crash; see StoreConfig.setTransactional .






www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.