List result = query.from(customer) //customer: Domain object
.where(customer.lastName.like("A%"), customer.active.eq(true)) //BooleanExpression x2
.orderBy(customer.lastName.asc(), customer.firstName.desc()) //OrderSpecifier x2
.list(customer);
JPAQuery qFrom = query.from(nn);
JPAQuery qFromWhere = qFrom.where(mm);
JPAQuery qFromWhereOrder = qFromWhere.orderBy(oo);
List result = qFromWhereOrder.list(customer);
$("span").fadeIn("slow").text("Alert!");
module Main where main :: IO () main = putStrLn "Hello, World!" -- Type annotation (optional) factorial :: Integer -> Integer -- Using recursion factorial 0 = 1 factorial n | n > 0 = n * factorial (n - 1)
| otherwise = error "No negs plz." -- Using fold (implements product) factorial' n = foldl1 (*) [1..n]
data TrafficLight = Red | Yellow | Green
type Name = String
data Person = Person { firstName :: Name , lastName :: Name , age :: Int } deriving Show
-- class is kind of like interface in Java
class YesNo a where
yesno :: a -> Bool
-- instances are the implementing part for some type
instance YesNo Int where
yesno 0 = False
yesno _ = True
instance YesNo [a] where
yesno [] = False
yesno _ = True
class Monad m where -- chain, bind (>>=) :: m a -> (a -> m b) -> m b -- inject, wrapper, pure return :: a -> m a
foo :: (Monad m) => Int -> m Int
bar :: (Monad m) => Int -> m Bool
return 1 >>= foo >>= bar
-- With 'concrete' State monad
foo' :: Int -> MyState Int
foo' x = do
put x
return x + x
bar' :: Int -> MyState Bool
bar' y = do
xFromState <- get
return y * xFromState > 10
stuff :: MyState Bool
stuff = return 1 >>= foo' >>= bar'
doStuff :: MyState Bool
doStuff = do
x <- foo' 1
z <- bar' x
return z
-- foo' 1 --> MyState 2 (1) --> bar' 2 --> MyState False (1)