1 |
|
2 /* |
|
3 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
4 * All rights reserved. |
|
5 * This component and the accompanying materials are made available |
|
6 * under the terms of the License "Eclipse Public License v1.0" |
|
7 * which accompanies this distribution, and is available |
|
8 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 * |
|
10 * Initial Contributors: |
|
11 * Nokia Corporation - initial contribution. |
|
12 * |
|
13 * Contributors: |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 package com.nokia.helium.jpa.entity; |
|
19 |
|
20 import javax.persistence.Entity; |
|
21 |
|
22 |
|
23 import javax.persistence.GeneratedValue; |
|
24 import javax.persistence.GenerationType; |
|
25 import javax.persistence.Id; |
|
26 import javax.persistence.Column; |
|
27 import javax.persistence.Basic; |
|
28 |
|
29 |
|
30 /** |
|
31 * Entity Version to store the db version. |
|
32 */ |
|
33 @Entity |
|
34 public class Version { |
|
35 |
|
36 public static final transient int DB_VERSION = 3; |
|
37 |
|
38 |
|
39 @Id |
|
40 @GeneratedValue(strategy = GenerationType.SEQUENCE) |
|
41 @Column(name = "VERSION_ID") |
|
42 private int id; |
|
43 |
|
44 //DB_VERSION to set as default if version changes |
|
45 @Basic |
|
46 @Column(unique = true, nullable = false) |
|
47 private int version = DB_VERSION; |
|
48 |
|
49 /** |
|
50 * Helper function to set the identifier for the log file. |
|
51 * @param identifier for the log file. |
|
52 */ |
|
53 public void setId(int identifier) { |
|
54 id = identifier; |
|
55 } |
|
56 |
|
57 /** |
|
58 * Helper function to get the identifier for the db schema version. |
|
59 * @return identifier for this log file. |
|
60 */ |
|
61 public int getId() { |
|
62 return id; |
|
63 } |
|
64 |
|
65 /** |
|
66 * Helper function to set the db schema version. |
|
67 * @param location of the log file. |
|
68 */ |
|
69 public void setVersion(int ver) { |
|
70 version = ver; |
|
71 } |
|
72 |
|
73 /** |
|
74 * Helper function to return the current db schema version. |
|
75 * @return path of the log file.. |
|
76 */ |
|
77 public int getVersion() { |
|
78 return version; |
|
79 } |
|
80 } |
|