留言板

table without primary key column

thumbnail
Priyanka Dhingra,修改在11 年前。

table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
I have a requirement to generate some tables without any primary column...
is that possible by service builder???
or any other way

Thanks in advance
Regards
Priyanka Dhingra
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: table without primary key column

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Can you give explanation on your situation?
I think you're not getting the fundamental design principle behind liferay.
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
I have foriegn key in that table...would try to come up with the scenario in a diagram if still the case i mentioned doesnt satisfy
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
Here is the sample diagram
in this in the state table we do not need a foriegn key.....

moreover , please suggest...if it is fine to use the
<column name="if_service" type="Collection" mapping-key="id" entity="activity" />

to establish the foriegn key reference relation??
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
Hope I can get a quick answer emoticon
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
Any help emoticon
thumbnail
David H Nebinger,修改在11 年前。

RE: table without primary key column

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Yes, you should go an hire yourself a DBA because you clearly don't understand DB concepts.

If you did, you would realize that your PK on the table is actually ID_SERVICE and ID_ACTIVITY. Doesn't matter that they are foreign keys also, they are the values that will identify a unique row that represents a single relationship between the activity and service table.
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
right emoticon
thanks David...
Ajeet Singh,修改在11 年前。

RE: table without primary key column

New Member 帖子: 14 加入日期: 12-3-27 最近的帖子
Hi Priyanka,

There should be a unique key in each table to fetch any row uniquely.

From the diagram posted by you, i understood that there might be many-to-many relationship between activity and service tables that's why a new table state has been created.

Now there are foreign key of activity table(id_activity) and service table(id_service) in the state table. Now here we should have a unique key in the state table and that unique key can be primary key or composite key ( id_activity + id_service).

So, i will say that in the current diagram you are not seeing the id ( i.e. primary key) so you might have the doubt about the primary key but here the design says that you should have composite key using id_activity and id_service.

Regards,
Ajeet Singh
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
Thanks for replying Ajeet.. I hope now I can work with my service builder with this er diagram
thumbnail
Priyanka Dhingra,修改在11 年前。

RE: table without primary key column

Liferay Master 帖子: 501 加入日期: 11-12-20 最近的帖子
thanks ajeet for the hint...

and i got solution to define a composite key like following in my service builder
<column name="id_service" primary="true" type="long" />
<column name="id_activity" primary="true" type="long" />
thumbnail
Vishal Panchal,修改在11 年前。

RE: table without primary key column

Expert 帖子: 289 加入日期: 12-5-20 最近的帖子
HI Priyanka,

hitoshi is right.

But according to me a table without primary key is a simply useless thing.
Because we usually store the data in tables for retrieving them in future so for retrieving the data we need even a single unique column.
Hope it will help you emoticon.!

Thanks&Regards,
Vishal R. Panchal