0

I'm asking myself about some hibernate annotations when using at the same time.

For example:

@OneToOne(optional = false)
@JoinColumn(name = "taskID", nullable = false, unique = true)
private Task task;

Ok, it's a oneToOne not optionnal... So it's impossible to have null or duplicate, isn't it? Do Hibernate do exactly the same thing accros all the differents DB?

In this case, what is preferable?... To be more precis, what do you prefer? Saying nullable and unique or not?

I know it seems stupid but that's the kind of questions that I want to eradicate from my mind.

polypiel
  • 2,321
  • 1
  • 19
  • 27
farvilain
  • 2,552
  • 2
  • 13
  • 24

1 Answers1

0

I feel it's generally best to avoid redundancy to keep things simple. If you are incredibly verbose all over the place it's hard to keep that consistency up. That's what defaults are for.

Hibernate follows the convention over configuration process fairly well: http://en.wikipedia.org/wiki/Convention_over_configuration

jervine10
  • 3,039
  • 22
  • 35