Java Doc for JdbcKeyGenerator.java in  » Testing » PolePosition-0.20 » com » versant » core » jdbc » 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 » Testing » PolePosition 0.20 » com.versant.core.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.versant.core.jdbc.JdbcKeyGenerator

All known Subclasses:   com.versant.core.jdbc.sql.HighLowJdbcKeyGenerator,  com.versant.core.jdbc.sql.AutoIncJdbcKeyGenerator,
JdbcKeyGenerator
public interface JdbcKeyGenerator (Code)
These generate primary keys for new rows in tables. Instances must be thread safe.




Method Summary
public  voidaddKeyGenTables(HashSet set, JdbcMetaDataBuilder mdb)
     Add any JdbcTable instances that this key generator requires to the supplied set.
public  voidgeneratePrimaryKeyPost(String className, JdbcTable classTable, Object[] data, Connection con, Statement stat)
     Generate a new primary key value for a new instance of the supplied class after the row has been inserted.
public  voidgeneratePrimaryKeyPre(String className, JdbcTable classTable, int newObjectCount, Object[] data, Connection con)
     Generate a new primary key value for a new instance of the supplied class prior to the row being inserted.
public  StringgetPostInsertSQLSuffix(JdbcTable classTable)
     Get extra SQL to be appended to the insert statement.
public  voidinit(String className, JdbcTable classTable, Connection con)
     Initialize this key generator.
public  booleanisPostInsertGenerator()
     If the new key can only be detirmined after the new row has been inserted (e.g.
public  booleanisRequiresOwnConnection()
     Does this key generator require its own connection? If it does then one will be obtained to generate the key and committed after the key has been generated.



Method Detail
addKeyGenTables
public void addKeyGenTables(HashSet set, JdbcMetaDataBuilder mdb)(Code)
Add any JdbcTable instances that this key generator requires to the supplied set. This method is called once per key generator during meta data generation. Any tables returned will be added to the meta data and will get into SQL scripts and so on. If the same key generator instance is returned more than once by a factory then this method will still only be called once on the instance.



generatePrimaryKeyPost
public void generatePrimaryKeyPost(String className, JdbcTable classTable, Object[] data, Connection con, Statement stat) throws SQLException(Code)
Generate a new primary key value for a new instance of the supplied class after the row has been inserted. The values generated will be used to populate a new OID and then set on a PreparedStatement for the insert. This is called if isPostInsertGenerator returns true.
Parameters:
  className - The name of the class
Parameters:
  classTable - The table for the class
Parameters:
  data - The array to store the key values in.
Parameters:
  con - Connection to the DataSource for the class.
Parameters:
  stat - Statement created from con. Do not close it. This will havejust been used to insert the new row.
throws:
  SQLException - on errors



generatePrimaryKeyPre
public void generatePrimaryKeyPre(String className, JdbcTable classTable, int newObjectCount, Object[] data, Connection con) throws SQLException(Code)
Generate a new primary key value for a new instance of the supplied class prior to the row being inserted. The values generated will be used to populate a new OID and then set on a PreparedStatement for the insert. This is called if isPostInsertGenerator returns false.

The newObjectCount parameter indicates the number of new objects that will be inserted (including this one) in the same transaction using this key generator. This may be used to optimize the behavior of the key generator or be ignored. The highlow key generator uses this value instead of its grabSize to avoid executing redundant updates and selects.


Parameters:
  className - The name of the class
Parameters:
  classTable - The table for the class
Parameters:
  newObjectCount - The number of new objects being created
Parameters:
  data - The array to store the key values in.
Parameters:
  con - Connection to the DataSource for the class.
throws:
  SQLException - on errors




getPostInsertSQLSuffix
public String getPostInsertSQLSuffix(JdbcTable classTable)(Code)
Get extra SQL to be appended to the insert statement. This is only called for post insert key generators. Return null if no extra SQL is required. Key generators can use this as an alternative to running a separate query to get the primary key for the just inserted row.



init
public void init(String className, JdbcTable classTable, Connection con) throws SQLException(Code)
Initialize this key generator. This is called when the JDO Genie server initializes before any keys are generated. Key generators should use this to avoid popular race conditions and deadlock opportunities (e.g. multiple 'select max(id) from table' statements executing at the same time). If the same key generator instance is used on more than one class this will be called once for each class.
Parameters:
  className - The name of the class
Parameters:
  classTable - The table for the class
Parameters:
  con - Connection to the DataSource for the class



isPostInsertGenerator
public boolean isPostInsertGenerator()(Code)
If the new key can only be detirmined after the new row has been inserted (e.g. if using a database autoincrement column) then this should return true.



isRequiresOwnConnection
public boolean isRequiresOwnConnection()(Code)
Does this key generator require its own connection? If it does then one will be obtained to generate the key and committed after the key has been generated. This is called prior to every key generation call.



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