Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
uG
Apr 23, 2003

by Ralp
UNLESS you are using an ORM then you can just deploy your schema. you are using an ORM right??

Adbot
ADBOT LOVES YOU

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
on the input side, no its sql queries in perl, but for the django bit i'm using a model as per the book (which took my db structure without complaints) and i retrieve stuff with objects.order_by and poo poo. best i can answer u right now

uG
Apr 23, 2003

by Ralp
i ended up using dbix::class::schema::loader to generate a schema from the clients mysql table, then deployed that schema through dbix::class::schema->deploy() to a postgresql db

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
if you're interested in lookin at database stuff a lil more in depth, a book i got recommended a while back (and am really enjoying) is Seven Databases in Seven Weeks

Posting Principle
Dec 10, 2011

by Ralp
postgres can be super complicated but i'm using it as babbys first rdbms and it seems ok. bigger problem for me right now is that my options for using it are "write sql" or "use these 3mbs of jars and 100 lines of xml"

double sulk
Jul 2, 2010

dbs are easy w/activerecord

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

uG posted:

i ended up using dbix::class::schema::loader to generate a schema from the clients mysql table, then deployed that schema through dbix::class::schema->deploy() to a postgresql db

ill, thanks. i'll goof this weekend

Notorious b.s.d.
Jan 25, 2003

by Reene

Posting Principle posted:

postgres can be super complicated but i'm using it as babbys first rdbms and it seems ok. bigger problem for me right now is that my options for using it are "write sql" or "use these 3mbs of jars and 100 lines of xml"

postgresql is the simplest rdbms on the market, which is what drives DBAs crazy. there are relatively few tunables, no query hinting, etc

for using it from java, the easiest way to not-write-sql is to use hibernate criteria + hibernate annotations. unfortunately i don't know of any easy tutorials other than like, buynig a book

or port to scala and use squeryl.

Notorious b.s.d.
Jan 25, 2003

by Reene
also in java always expect to use 3 mb of jars. just get maven set up once, add the dependency, and the 300 mb of jars appears by magic in classpaths and poo poo

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
lightweight activerecord-type stuff is a-ok but real orms are awful. they generate terrible sql and if you're on mysql you can't afford any inefficiency.

Posting Principle posted:

postgres can be super complicated but i'm using it as babbys first rdbms and it seems ok. bigger problem for me right now is that my options for using it are "write sql" or "use these 3mbs of jars and 100 lines of xml"

and then there are the people that generate those 100 lines of XML, or SQL translated verbatim into obtuse object-oriented method calls, and somehow think it's an improvement over a plain ol' goddamned SQL query

Johnny Cache Hit
Oct 17, 2011

Tiny Bug Child posted:

lightweight activerecord-type stuff is a-ok but real orms are awful. they generate terrible sql and if you're on mysql you can't afford any inefficiency.


and then there are the people that generate those 100 lines of XML, or SQL translated verbatim into obtuse object-oriented method calls, and somehow think it's an improvement over a plain ol' goddamned SQL query

wow

one right post one wrong post

youve blaanced your karma very nice

Nomnom Cookie
Aug 30, 2009



Spring Data JPA takes in JPA entities and produces DAOs, plus of course it interoperates with other Spring stuff like transaction management. It's my go-to for dumb database things. The only real downside is that last I checked you basically had to use their XML config as there wasn't any annotation like @EnableWebMvc and making the beans yourself is a PITA.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Notorious b.s.d. posted:

also in java always expect to use 3 mb of jars. just get maven set up once, add the dependency, and the 300 mb of jars appears by magic in classpaths and poo poo

You should just drop the loving jars in your application servers lib dir so you don't need to gently caress around with any of that poo poo.

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

Hard NOP Life posted:

You should just drop the loving jars in your application servers lib dir so you don't need to gently caress around with any of that poo poo.

maven's for building, not for running applications

Socracheese
Oct 20, 2008

Jonny 290 posted:

ill, thanks. i'll goof this weekend

im still sort of a scrub but i do django things to recieve income so feel free to ask when you fall into a noob pitfall :)

also #django on freenode has been a good resource for me, theres a lot of dudes who sit on there at their jobs all day and they will always help with ur stupid problems

Shaggar
Apr 26, 2006

Hard NOP Life posted:

You should just drop the loving jars in your application servers lib dir so you don't need to gently caress around with any of that poo poo.

you can do that if you know its the only app running there or if everyone swears to use the same dependencies, otherwise its a bad idea. either way when building the project you'll still want the libs reference in your pom. if they're provided by the server you can mark them as provided (for example: servlet-api should probably always be marked as provided if ur deploying to tomcat/jetty). Either way it lists everything the project needs to run and/or compile so if you change stuff in the future you don't have to hunt down the server config to figure out what was provided.

Nomnom Cookie
Aug 30, 2009



Here's the 30-second thing on why I think Spring Data JPA is cool. First you tell it to look for repository interfaces with <jpa:repositories base-package="my.package.is.large"/> and it will go find all your interfaces that extend JpaRepository. Then it looks up the JPA entity associated with each repo interface and generates an implementation for the interface. So you get basic DAO methods for free, findByID, save, create, whatever. Then you can also define methods on your repo interfaces and Spring Data JPA will read the name + signature to generate an appropriate implementation.

Looking at this repo interface:

code:
package my.package.is.large;

public interface BonerRepository extends JpaRepository<Integer, Boner> {
    List<Boner> findByLength(int inches);
    List<Boner> findByLength(int inches, int offset, int limit);
}
Spring Data JPA knows that the entity class is Boner with a PK of Integer. It will introspect the Boner and see the length property, and the findByLength methods will query the appropriate column. It also looks at parameter names so you can do things like the second method on BonerRepository and create paged queries by declaring appropriate params on the finder method.

edit: Also you can annotate methods to specify SQL for them, if you want something more complex than the declaration parser can handle or if you're Shaggar.

Nomnom Cookie fucked around with this message at 18:35 on Sep 25, 2013

Shaggar
Apr 26, 2006
see I like mybatis-spring cause I can do like

Java code:
public interface BonerMapper
{
	List<Boner> findBonerByLength(int inches);
}
and then in BonerMapper.xml
XML code:
<select queryName="findBonerByLength">
exec getBonerByLength_sel_sp({inches})
</select>
and then in spring you turn on spring-mybatis autobinding and it magically creates a proxy of interface BonerMapper named bonerMapper that binds the abstract methods to the queries in BonerMapper.xml of the same name+parameters.

Shaggar
Apr 26, 2006
ahhhh I love spring-mybatis! is so good!

Posting Principle
Dec 10, 2011

by Ralp
that mybatis thing actually seems pretty cool. does the Boner class still need any annotations? how much of spring do you need to bring in to do that?

Shaggar
Apr 26, 2006
No. I have 0 annotations anywhere in my code cause I'm just injecting everything. I don't even use transaction annotations cause I use a pointcut to specify the transaction manager in spring.

Nomnom Cookie
Aug 30, 2009



Shaggar posted:

see I like mybatis-spring cause I can do like

Java code:
public interface BonerMapper
{
	List<Boner> findBonerByLength(int inches);
}
and then in BonerMapper.xml
XML code:
<select queryName="findBonerByLength">
exec getBonerByLength_sel_sp({inches})
</select>
and then in spring you turn on spring-mybatis autobinding and it magically creates a proxy of interface BonerMapper named bonerMapper that binds the abstract methods to the queries in BonerMapper.xml of the same name+parameters.

Spring Data JPA supports that style via JPA named queries.

Notorious b.s.d.
Jan 25, 2003

by Reene

Shaggar posted:


and then in spring you turn on spring-mybatis autobinding and it magically creates a proxy of interface BonerMapper named bonerMapper that binds the abstract methods to the queries in BonerMapper.xml of the same name+parameters.

that's pretty cute

Nomnom Cookie
Aug 30, 2009



Posting Principle posted:

that mybatis thing actually seems pretty cool. does the Boner class still need any annotations? how much of spring do you need to bring in to do that?

Spring Data JPA allows you to go full Shaggar and configure everything in XML including entity mappings. Sane people will use the JPA entity annotations.

Nomnom Cookie
Aug 30, 2009



Mybatis gives you more flexibility with result mapping, Spring Data JPA will generate queries from your method declarations.

Shaggar
Apr 26, 2006

Notorious b.s.d. posted:

that's pretty cute

you can also configure what mappers it creates and how and what it binds them to but if everything is named the same I don't see the point so I let it auto wire it all. it rules.


Nomnom Cookie posted:

Mybatis gives you more flexibility with result mapping, Spring Data JPA will generate queries from your method declarations.

since all my queries are procs result mapping is generally what im gonna spend most of my time on. if your result columns match your result class fields mybatis will auto map them too (I assume spring jpa does that too tho)

Posting Principle
Dec 10, 2011

by Ralp
bringing in spring kind of seems like overkill for such a small project, maybe next time

Shaggar
Apr 26, 2006
spring is magic. it can be used for great good or for terrible evil.

u said u were using cxf right? cxf uses spring for configuration.

Posting Principle
Dec 10, 2011

by Ralp

Shaggar posted:

spring is magic. it can be used for great good or for terrible evil.

u said u were using cxf right? cxf uses spring for configuration.

i didn't realize that. i'll probably have time to work on it this weekend so i'll look into spring jpa. i also need to mavenize the project, because right now IDEA is handling all the dependencies. might as well do these things right

Posting Principle
Dec 10, 2011

by Ralp
tell hn: i'm an idiot retard who can't manage a java project

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Shaggar posted:

you can do that if you know its the only app running there or if everyone swears to use the same dependencies, otherwise its a bad idea. either way when building the project you'll still want the libs reference in your pom. if they're provided by the server you can mark them as provided (for example: servlet-api should probably always be marked as provided if ur deploying to tomcat/jetty). Either way it lists everything the project needs to run and/or compile so if you change stuff in the future you don't have to hunt down the server config to figure out what was provided.

Right I know all that, I was specifically referring to the 3mb jar files which are usually the db drivers. Which like you said should be declared as provided dependencies in your POM.

IMO DB drivers and logging implementations are the only libs you want to be in your applications servers lib dir because honestly it's easy to get everyone to agree on which version to use and no one is going to be making changes to those anytime soon so you might as well not have them in your war.

Pollyanna
Mar 5, 2005

Milk's on them.


how do i gui

Posting Principle
Dec 10, 2011

by Ralp
in python? pyqt/pyside

Bloody
Mar 3, 2013

Pollyanna posted:

how do i gui

wpf

Shark Sandwich
Sep 6, 2010

by R. Guyovich
comedy option: swing

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Shaggar posted:

ahhhh I love spring-mybatis! is so good!

i'm gonna try moving my rails project over to mybatis it looks fun

a cyberpunk goose
May 21, 2007

please dont gtk

a cyberpunk goose
May 21, 2007

i wish i knew why people use gtk it's so loving fiddly and featureless

Pollyanna
Mar 5, 2005

Milk's on them.


Posting Principle posted:

in python? pyqt/pyside

i hear either this or wxpython

apparently neither are particularly well documented :shepface:

Adbot
ADBOT LOVES YOU

compuserved
Mar 20, 2006

Nap Ghost

Pollyanna posted:

how do i gui

very carefully

  • Locked thread