• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Post And Attachment

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Developers,

In the JForum 2.1.6 the Post has a attibute called attachment and it's a boolean, but in the database it acts like a integer, and there is a logic(remove Attachment) that saves the count like a integer.

But in the new JForum this attribute still being a boolean but it's transient....and even I change for non-trasient i'll can't save in the bank because it should be a integer...
[originally posted on jforum.net by Guilherme Moreira]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The database is as an integer because 0 => false, 1 => true ;)

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But in hibernate we don't want to work in the logics thinking and Database, we can work with boolean.
[originally posted on jforum.net by Guilherme Moreira]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It was probably a integer because there's a lot of variance between DB servers as to how to store a Boolean in SQL statement. Some use 0/1 and some use true / false (e.g. Postgres).

I assume that Hibernate handles the translation based on server type and so you can specify Boolean as a logical field type.

Only issue I can see here is possible upgrade issues. Not only will the schema have to be altered but the data will have to be migrated.

Does Hibernate have any "automatic conversions" build in. I know in Torque you can define the field as Boolean, but if the underlying DB schema is integer it will try to convert it. (uses Meta info from the DB to map between SQL type and JDBC/Torque data type).


[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Migration scripts were never a problem - easy to detect and easy to make, so we can proceed with the suggested logic without any problem.

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic