I have some logging tables that log simple things like when someone visits a particular webpage or whenever someone attempts to login. So for login attempts, the following <set> might be within a Person hibernate mapping:
Code:
<set name="loginAttempts" table="Login_Attempt">
<key column="Person_Id"/>
<composite-element class="com.treert.account.LoginAttempt">
<property name="success" column="Success" type="boolean" not-null="true"/>
<property name="loginDate" column="Login_Date" type="timestamp" not-null="true"/>
<property name="ipAddress" column="IP_Address" type="int" length="32" not-null="true"/>
</composite-element>
</set>
Maybe a hacker is trying a million passwords and so this table could have 2 rows with exactly the same entries. i don't want the hacker to get a MySQL exception! :), well maybe this example isn't the greatest, but other parts of my code with exactly the same situation are important for me to log duplicate rows.
How can I tell hibernate to allow 2 rows with the same data? I understand the limitations of then being able to update or delete these rows, this is purely for logging purposes. I'll read the rows in bulk.[/code]