Skip to main content
Log in

Genericity in Java: persistent and database systems implications

  • Regular Paper
  • Published:
The VLDB Journal Aims and scope Submit manuscript

Abstract

Lack of parametric polymorphism has been a major obstacle for making Java a viable database programming language. Regrettably, a recently accepted solution for genericity in Java 5.0 has far-reaching negative implications for persistent and database systems because of static and dynamic type violations. Severe implications occur in typical database transactions when processing a variety of database collections. Well-known approaches to persistence in Java, including Java’s own persistence mechanism, do not perform correctly due to incorrect dynamic type information that gets promoted to persistence along with objects. Dynamic checking of types of objects fetched from the persistent store may now lead to unexpected type violations. Further problems occur in reflective transactions as Java Core Reflection now allows dynamic type violations without detecting them or throwing standard exceptions. All of this shows that extending Java with parametric polymorphism has not made Java a more viable database programming language. Both legacy systems, such as those based on the Java binding of the ODMG or JDO, and future Java-related persistent and database technologies will be affected. The source of these problems is in an implementation idiom called type erasure. This paper provides formal proofs of the above implications of type erasure along with specific samples of code in Java 5.0 illustrating these violations. The limitations of the virtual platform and extensions required for persistent systems to solve this problem are also elaborated.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Agesen, O., Freund, S.N., Mitchell, J.C.: Adding type parameterization to the Java language, In: Proceedings of OOPSLA ’97, ACM, pp. 49–65 (1997)

  2. Alagić S. (1999). Type checking OQL queries in the ODMG type systems. ACM Trans. Database Syst. 24(3): 319–360

    Article  Google Scholar 

  3. Alagić, S.: The ODMG object model: does it make sense? In: Proceedings of the OOPSLA ’97 Conference, ACM, pp. 253–270 (1997)

  4. Alagić S. and Solorzano J. (2000). Java and OQL: a reflective solution for the impedance mismatch, Java and Databases. L’objet, 6: 3

    Google Scholar 

  5. Alagić, S., Ngyen, T.: Parametric polymorphism and orthogonal persistence. In: Proceedings of the ECOOP 2000 Symposium on Objects and Databases. Lecture Notes in Computer Science vol. 1813, pp. 32–46. Springer, Heidelberg (2001)

  6. Allen, E., Bannet, J., Cartwright, R.: A first-class approach to genericity. In: Proceedings of OOPSLA 2003, pp. 96–114 (2003)

  7. Allen, E., Cartwright, R., Stoler, B.: Efficient implementation of run-time generic types for Java. Generic Programming, pp. 207–236 (2002)

  8. Arnold K., Gosling J. and Holmes D. (2005). The Java Programing Language. Addison-Wesley, New York

    Google Scholar 

  9. Atkinson M. and Morrison R. (1995). Orthogonally persistent object systems.. VLDB J. 4: 319–401

    Article  Google Scholar 

  10. Atkinson M., Daynes L., Jordan M.J., Printezis T. and Spence S. (1996). An orthogonally persistent JavaTM. ACM SIGMOD Record 25: 68–75

    Article  Google Scholar 

  11. Atkinson, M., Bancilhon, F., DeWitt, D., Dittrich, K., Zdonik, S.: The object-oriented database system manifesto. In: Proceedings of the First Object-Oriented and Deductive Database Conference, (DOOD), pp. 40–75, Kyoto, (1989)

  12. Bierman, G., Meijer, E., Schulte, W.: The essence of data access in C ω, Microsoft Research, (2004)

  13. Bracha, G., Odersky, M., Stoutamire, D., Wadler, P.: Making the future safe for the past: Adding genericity to the Java programming language. In: Proceedings of OOPSLA 1998, ACM pp. 183–200 (1998)

  14. Bretl, B., Otis, A., San Soucie, M., Schuchardt, B., Venkatesh, R.: Persistent Java objects in 3 tier architectures. In: Morrison, R., Jordan, M. (eds.) Atkinson, M. Advances in Persistent Object Systems, pp. 236-249, Morgan Kaufmann, San Francisco (1999)

  15. Bruce K. (2002). Foundations of Object-Oriented Languages. MIT Press, Cambridge

    Google Scholar 

  16. Bruce, K., Schuett, A., van Gent, R.: PolyTOIL: a type-safe polymorphic object-oriented language. In: Proceedings of ECOOP ’95. Lecture Notes in Computer Science, vol. 952, pp. 27–51 Springer, Heidelberg (1995)

  17. Cabana, B., Alagić, S., Faulkner, J.: Parametric polymorphism for Java: Is there any hope in sight? ACM SIGPLAN Notices, pp. 22–31 (2004)

  18. Canning, P., Cook, W., Hill, W., Olthoff, W., Mitchell, J.: F-bounded polymorphism for object-oriented programming languages. In: Proceedings of Functional Programming Languages and Computer Architecture, ACM, pp. 273-280 (1989)

  19. Cartwright, R., Steele, G.L.: Compatible genericity with run-time types for the Java programming language, Proceedings of OOPSLA 98, pp. 201–218

  20. Cattell, R.G.G., Barry, D., Berler, M., Eastman, J., Jordan, D., Russell, C., Schadow, O., Stanienda, T., Velez, F.: The Object Data Standard: ODMG 3.0. Morgan Kaufmann, San Francisco (2000)

  21. Drossopoulou, S., Eisenbach, S.: Java is type safe—probably. Proceedings of ECOOP ’97. Lecture Notes in Computer Science vol. 1241, pp. 389–418, Springer, Heidelberg (1997)

  22. Fisher M., Ellis J. and Bruce J. (2003). JDBC API Tutorial and Reference. Addison-Wesley, New York

    Google Scholar 

  23. Gosling, J., Joy, B., Steel, G., Bracha, G.: The Java Language Specification, 3rd edn. (2005)

  24. Igarashi A., Pierce B. and Wadler P. (2001). Featherweight Java: a minimal calculus for Java and GJ. ACM TOPLAS 23(3): 396–450

    Article  Google Scholar 

  25. Jordan, M., Atkinson, M.: Orthogonal persistence for Java—A mid-term report. In: Morrison, R., Jordan, M., Atkinson, M. (eds.) Advances in Persistent Object Systems, pp. 335–352. Morgan Kaufmann San Francisco (1999)

  26. Java Core Reflection, JDK 1.1, Sun Microsystems, 1997

  27. Java 5.0, Sun Microsystems, 2004

  28. JavaTM Data Objects, JSR 000012, Forte Tools, Sun Microsystems Inc., 2000

  29. Jordan, D., Russell, C.: Java Data Objects. O’Reilly, Köln (2003)

  30. Kennedy, A., Syme, D.: Design and implementation of generics for the .NET Common Language Runtime. In: Proceedings of PLDI, ACM, pp. 1–12 (2001)

  31. Kirby, G., Morrison, R., Stemple, D.: Linguistic reflection in Java. Softw. Pract. Exp. 28(10), (1998)

  32. Lindholm, T., Yellin, F.: The JavaTM Virtual Machine Specification. Addison-Wesley, New York (2000)

  33. Myers, A., Bank, J., Liskov, B.: Parameterized types for Java. In: Proceedings of POPL, ACM, pp. 132–145 (1997)

  34. Nipkow, T., von Oheimb, D.: Java light is type safe—definitely. In: Proceedings of POPL ’98, ACM, pp. 161–170 (1998)

  35. Odersky, M., Wadler, P.: Pizza into Java: Translating theory into practice. In: Proceedings of POPL 1997, ACM, pp. 146–159 (1997)

  36. Palsberg J. and Schwartzbach M. (1994). Object-oriented type systems. Wiley, New York

    MATH  Google Scholar 

  37. Solorzano, J., Alagić, S.: Parametric polymorphism for JavaTM: a reflective solution. In: Proceedings of OOPSLA ’98, ACM, pp. 216–225 (1998)

  38. Virolli, M., Natali, A.: Parametric polymorphism in Java: An approach to translation based on reflective features. In: Proceedings of OOPSLA 2000, ACM, pp. 146–165 (2000)

  39. Versant FastObjects, http://www.versant.com/products/ fastobjects.

  40. Yu, D., Kennedy, A., Syme, D.: Formalization of generics for .NET common language runtime. In: Proceedings of POPL, ACM, pp. 39–63 (2004)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Suad Alagić.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Alagić, S., Royer, M. Genericity in Java: persistent and database systems implications. The VLDB Journal 17, 847–878 (2008). https://doi.org/10.1007/s00778-006-0042-x

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00778-006-0042-x

Keywords

Navigation