These are chat archives for codelibra/College-khabar

23rd
Apr 2016
satyajn1
@satyajn1
Apr 23 2016 08:03
Every method is static in DBConnect is more like a utility class ..Methods are not dependent on instance creation ..I couldn't think of the scenario where we would ever need to create instance of this class, that's why the constructor is also private..another way was to make the class singleton and then make every method non static and access through this object...but why should we bother about calling getInstance() every time for accessing some method..so I made every method static..
satyajn1
@satyajn1
Apr 23 2016 08:13
One user will have only one role.Each role will have a set of privileges. - if we do like this then we would end up making lots of roles unnecessarily...suppose there r 2 privileges P1 and P2, then some user has privilege P1 and another has P2 and then someone has both.. then you will have to define 3 roles which doesn't make sense
satyajn1
@satyajn1
Apr 23 2016 08:59
*in DBConnect because it
sst2k2
@sst2k2
Apr 23 2016 13:20
Regarding DBConnect class...first assumption that it will just be a utility class is doubtful. There can be 2 scenarios when the DBConnect class stores data to a particular connection or not. In case it stores data to a single connection with database then we probably would need multiple instances of DBConnect as single application should be able to make multiple connections to db. Single connection wont do the job...I have many scenarios to explain this. Second case where DBConnect is just a utility class that provides a new connection when feeded in with connection parameters.In addition to this there is a wrapper class that holds data for connection. So current implementation is neither of the two...the connection params are being asked from System properties.Singleton class usage would better for our usage puposes...you can check out at this link...
Regarding roles we need to discuss...
satyajn1
@satyajn1
Apr 23 2016 14:17
okay..i didn't keep multithreaded environment in mind where we'll need multiple connections..we should use a connection pool then..
Shivendra
@codelibra
Apr 23 2016 14:21
dbconnect should not be static.. this was a test class to test end to end functionality.
database connection usually has a thread pool of size 10-40, so there are multiple connections to the DB and each connection is Transactional
we will integrate with Spring so, it will take care of the instance creation and all...
we need not worry about these things.
Spring will take care of the instance pooling and all... so chill out on this discussion.
As per multi-role scenario...
it is ok to give 1 role per person if we are sure that... number of roles will be less.
But if we can predict they will be a lot.. then it will be difficult to manage one role per person scenario.
Shivendra
@codelibra
Apr 23 2016 14:26
I think number of roles will not be too many. Well within ~20
we can keep it simple by having one role per person also :smile:
satyajn1
@satyajn1
Apr 23 2016 14:30
spring or hibernate??
sst2k2
@sst2k2
Apr 23 2016 14:36
Hibernate is only for persisting data into db.
Use of spring needs to be discussed
satyajn1
@satyajn1
Apr 23 2016 14:36
spring also provides ORM, no?
sst2k2
@sst2k2
Apr 23 2016 14:37
yes....but its not just that
it is a complete framework for building server
satyajn1
@satyajn1
Apr 23 2016 14:38
no, what i am saying is why r we using hibernate then, if we're gonna use spring anyway
Shivendra
@codelibra
Apr 23 2016 14:38
spring is mostly related to managing instance pool across ur application.
ORM is for mapping ur domain objects into database tables.
Both have diffrent jobs to perform.
sst2k2
@sst2k2
Apr 23 2016 14:38
There are many frameworks available for the same purpose we need to decide which one would be best for our purpose
Shivendra
@codelibra
Apr 23 2016 14:39
spring and hibernate work together.
what is the confusion about?
satyajn1
@satyajn1
Apr 23 2016 14:39
hibernate is sort of subset of spring, no?
Shivendra
@codelibra
Apr 23 2016 14:39
no no
satyajn1
@satyajn1
Apr 23 2016 14:39
spring also provides ORM
Shivendra
@codelibra
Apr 23 2016 14:40
hibernate, ibaitis and all are ORM only frameworks
satyajn1
@satyajn1
Apr 23 2016 14:40
yeah i know
Shivendra
@codelibra
Apr 23 2016 14:40
spring is used for dependency injection
i mean for instance management across various classes in ur application
both are used together..spring and hibernate
Shivendra
@codelibra
Apr 23 2016 14:42
spring also provides ORM is that what u are asking?
or is it something else?
satyajn1
@satyajn1
Apr 23 2016 14:42
yes
check this one second ansr
Shivendra
@codelibra
Apr 23 2016 14:43
ok so the answer is
arey ruk to jao
sst2k2
@sst2k2
Apr 23 2016 14:43
The ORM mentioned in ur link is not of spring
Shivendra
@codelibra
Apr 23 2016 14:43
i understand what u are asking
sst2k2
@sst2k2
Apr 23 2016 14:43
Its just indicating that u can use any orm
Shivendra
@codelibra
Apr 23 2016 14:43
?
sst2k2
@sst2k2
Apr 23 2016 14:44
I meant the link that satya shared..
Shivendra
@codelibra
Apr 23 2016 14:44
ptani what is the real doubt
satyajn1
@satyajn1
Apr 23 2016 14:44
got it
Shivendra
@codelibra
Apr 23 2016 14:44
but anywys let me tell u what i knw and have experience with
have been using spring and mybatis for long
satyajn1
@satyajn1
Apr 23 2016 14:45
I got it
resolved
Shivendra
@codelibra
Apr 23 2016 14:45
so spring has all kinds of integrations with these orm frameworks
sst2k2
@sst2k2
Apr 23 2016 14:45
yup
Shivendra
@codelibra
Apr 23 2016 14:45
but it is not meant to natively do that
natively it is more of AOP and DI thing
this getInstance and alll boiler plate code need not be written
and goes to spring xml files
chill guys.... we will integrate with spring and hibernate
Not a big deal.
so shushant u r deR?
sst2k2
@sst2k2
Apr 23 2016 14:46
Okz...I need to get some idea about sporing
spring
satyajn1
@satyajn1
Apr 23 2016 14:46
me too
Shivendra
@codelibra
Apr 23 2016 14:47
i will explain spring and how it works
where all it can be used
firstly let us discuss about hibernate
sst2k2
@sst2k2
Apr 23 2016 14:47
okz
Shivendra
@codelibra
Apr 23 2016 14:47
shusaht can u explain that
sst2k2
@sst2k2
Apr 23 2016 14:47
okz we can discuss on hangout
Shivendra
@codelibra
Apr 23 2016 14:47
wht is the setup u have done for the same? and why?
sst2k2
@sst2k2
Apr 23 2016 14:47
it would be btr
Shivendra
@codelibra
Apr 23 2016 14:47
and how can we reuse the setup
sst2k2
@sst2k2
Apr 23 2016 14:47
ok
Shivendra
@codelibra
Apr 23 2016 14:47
yes let;s connect on hangout
sst2k2
@sst2k2
Apr 23 2016 14:47
hmm
satyajn1
@satyajn1
Apr 23 2016 14:48
ok