Questions tagged [identity]

An inherent property of an entity that distinguishes that entity from all others. Frequently used to refer to user identity and authentication.

Identity typically refers to user identity in authentication scenarios.

2969 questions
1305
votes
15 answers

Why does comparing strings using either '==' or 'is' sometimes produce a different result?

Two string variables are set to the same value. s1 == s2 always returns True, but s1 is s2 sometimes returns False. If I open my Python interpreter and do the same is comparison, it succeeds: >>> s1 = 'text' >>> s2 = 'text' >>> s1 is s2 True Why is…
jottos
  • 20,098
  • 9
  • 30
  • 27
768
votes
26 answers

What is the difference between == and equals() in Java?

I wanted to clarify if I understand this correctly: == is a reference comparison, i.e. both objects point to the same memory location .equals() evaluates to the comparison of values in the objects
brainydexter
  • 19,826
  • 28
  • 77
  • 115
616
votes
11 answers

"is" operator behaves unexpectedly with integers

Why does the following behave unexpectedly in Python? >>> a = 256 >>> b = 256 >>> a is b True # This is an expected result >>> a = 257 >>> b = 257 >>> a is b False # What happened here? Why is this False? >>> 257 is 257 True …
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
573
votes
12 answers

Auto increment primary key in SQL Server Management Studio 2012

How do I auto increment the primary key in a SQL Server database table? I've had a look through the forum but can't see how to do this. I've looked at the properties but can't see an option. I saw an answer where you go to the Identity specification…
Ledgemonkey
  • 7,223
  • 12
  • 36
  • 56
390
votes
20 answers

The JPA hashCode() / equals() dilemma

There have been some discussions here about JPA entities and which hashCode()/equals() implementation should be used for JPA entity classes. Most (if not all) of them depend on Hibernate, but I'd like to discuss them JPA-implementation-neutrally (I…
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
280
votes
11 answers

How to get the unique ID of an object which overrides hashCode()?

When a class in Java doesn't override hashCode(), printing an instance of this class gives a nice unique number. The Javadoc of Object says about hashCode(): As much as is reasonably practical, the hashCode method defined by class Object does…
ivan_ivanovich_ivanoff
  • 19,113
  • 27
  • 81
  • 100
262
votes
7 answers

What is the difference between Scope_Identity(), Identity(), @@Identity, and Ident_Current()?

I know Scope_Identity(), Identity(), @@Identity, and Ident_Current() all get the value of the identity column, but I would love to know the difference. Part of the controversy I'm having is what do they mean by scope as applied to these functions…
Orson
  • 14,981
  • 11
  • 56
  • 70
255
votes
11 answers

ASP.NET MVC 5 - Identity. How to get current ApplicationUser

I have an Article entity in my project which has the ApplicationUser property named Author. How can I get the full object of currently logged ApplicationUser? While creating a new article, I have to set the Author property in Article to the current…
Ellbar
  • 3,984
  • 6
  • 24
  • 36
160
votes
13 answers

How to change identity column values programmatically?

I have a MS SQL 2005 database with a table Test with column ID. ID is an identity column. I have rows in this table and all of them have their corresponding ID auto incremented value. Now I would like to change every ID in this table like this: ID…
Tom Smykowski
  • 25,487
  • 54
  • 159
  • 236
139
votes
8 answers

How to generate unique id in Dart

I write websocket chat. How to generate unique id for user? now i use this code: id = new DateTime.now().millisecondsSinceEpoch; is there any more neat solution?
Sergey Karasev
  • 4,513
  • 4
  • 25
  • 24
130
votes
5 answers

Generating human-readable/usable, short but unique IDs

Need to handle > 1000 but < 10000 new records per day Cannot use GUID/UUIDs, auto increment numbers etc. Ideally should be 5 or 6 chars long, can be alpha of course Would like to reuse existing, well-known algos, if available Anything out there ?
Kumar
  • 10,997
  • 13
  • 84
  • 134
130
votes
3 answers

SQL Server 2012 column identity increment jumping from 6 to 1000+ on 7th entry

I have a strange scenario in which the auto identity int column in my SQL Server 2012 database is not incrementing properly. Say I have a table which uses an int auto identity as a primary key it is sporadically skipping increments, for…
Andy Clark
  • 3,363
  • 7
  • 27
  • 42
101
votes
4 answers

What is the purpose of the ConcurrencyStamp column in the AspNetUsers table in the new ASP.NET MVC 6 identity?

What is the purpose of the ConcurrencyStamp column in the AspNetUsers table in the new ASP.NET MVC 6 identity? This is the database schema of the AspNetUsers table: It is also there in the AspNetRoles table: As I remember it wasn't there in the…
91
votes
5 answers

How to insert into a table with just one IDENTITY column?

(Came up with this question in the course of trying to answer this other one) Consider the following MS-SQL table, called GroupTable: GroupID ------- 1 2 3 where GroupID is the primary key and is an Identity column. How do you insert a new…
codeulike
  • 22,514
  • 29
  • 120
  • 167
74
votes
6 answers

How does Hibernate detect dirty state of an entity object?

Is it using some kind of byte codes modification to the original classes? Or, maybe Hibernate get the dirty state by compare the given object with previously persisted version? I'm having a problem with hashCode() and equals() methods for…
Lenik
  • 13,946
  • 17
  • 75
  • 103
1
2 3
99 100